diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d0b9a1a..5c32926 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -176,7 +176,29 @@ jobs: --publish ${{ inputs.dry-run && 'never' || 'always' }} ${{ matrix.os == 'windows-latest' && '--win' || '' }} --config.artifactName='${name}-${version}-${arch}-${os}-${buildTime}.${ext}' + # 添加错误处理逻辑 + on_retry_command: | + echo "Checking if assets already exist..." + if [[ $ERROR_OUTPUT == *"already_exists"* ]]; then + echo "Assets already exist, treating as success" + exit 0 + fi + continue_on_error: true # 允许任务继续执行 env: GH_TOKEN: ${{ secrets.GH_TOKEN }} BUILD_TIME: ${{ github.run_number }} + # 添加验证步骤 + - name: Verify Release Assets + if: success() || failure() # 即使前一步失败也运行 + run: | + RELEASE_URL="https://api.github.com/repos/${{ github.repository }}/releases/latest" + ASSETS=$(curl -H "Authorization: token ${{ secrets.GH_TOKEN }}" $RELEASE_URL) + if echo "$ASSETS" | grep -q "${BUILD_TIME}"; then + echo "Release assets verified successfully" + exit 0 + else + echo "Release assets verification failed" + exit 1 + fi +