Skip to content

Commit 7415af1

Browse files
MingMing
Ming
authored and
Ming
committed
处理重复上传打包文件 问题
1 parent 756ca83 commit 7415af1

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

.github/workflows/release.yml

+22
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,29 @@ jobs:
176176
--publish ${{ inputs.dry-run && 'never' || 'always' }}
177177
${{ matrix.os == 'windows-latest' && '--win' || '' }}
178178
--config.artifactName='${name}-${version}-${arch}-${os}-${buildTime}.${ext}'
179+
# 添加错误处理逻辑
180+
on_retry_command: |
181+
echo "Checking if assets already exist..."
182+
if [[ $ERROR_OUTPUT == *"already_exists"* ]]; then
183+
echo "Assets already exist, treating as success"
184+
exit 0
185+
fi
186+
continue_on_error: true # 允许任务继续执行
179187
env:
180188
GH_TOKEN: ${{ secrets.GH_TOKEN }}
181189
BUILD_TIME: ${{ github.run_number }}
182190

191+
# 添加验证步骤
192+
- name: Verify Release Assets
193+
if: success() || failure() # 即使前一步失败也运行
194+
run: |
195+
RELEASE_URL="https://api.github.com/repos/${{ github.repository }}/releases/latest"
196+
ASSETS=$(curl -H "Authorization: token ${{ secrets.GH_TOKEN }}" $RELEASE_URL)
197+
if echo "$ASSETS" | grep -q "${BUILD_TIME}"; then
198+
echo "Release assets verified successfully"
199+
exit 0
200+
else
201+
echo "Release assets verification failed"
202+
exit 1
203+
fi
204+

0 commit comments

Comments
 (0)