block-ci: let a release rerun replace the assets of a published tag

gh release create fails once the tag's release exists, after both image
pushes have already run again. Keep the imported helper's existing-release
path: edit the prerelease flag and upload with --clobber.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Chris LuandClaude Opus 5.5 committed 2026-12-05 04:07:23 -08:00
1 parent 3f21fa9549
commit d216bfda15
2 files changed
+11 -3

No files matched your search

@@ -65,6 +65,7 @@ class PortTests(unittest.TestCase):
self.assertIn('docker pull "${BLOCK_IMAGE}@${BLOCK_DIGEST}"', text)
self.assertIn('gh release create "$GITHUB_REF_NAME"', text)
self.assertIn('--latest=false', text)
self.assertIn('gh release upload "$GITHUB_REF_NAME" "$out/$asset" "$out/SHA256SUMS" --repo "$GITHUB_REPOSITORY" --clobber', text)
self.assertIn("runs-on: ubuntu-latest", text)
self.assertNotIn("BLOCK_RUNNER_LABEL", text)
self.assertIn('sw-block-${version}-linux-amd64.tar.gz', text)
+10 -3
View File
@@ -138,9 +138,16 @@ jobs:
asset="sw-block-${version}-linux-amd64.tar.gz"
tar -C "$out/bin" -czf "$out/$asset" blockmaster blockvolume sw-block
(cd "$out" && sha256sum "$asset" >SHA256SUMS)
args=(--repo "$GITHUB_REPOSITORY" --verify-tag --latest=false --title "Seaweed Block $version" --notes-file "$NOTES")
if [[ "$version" == *-* ]]; then args+=(--prerelease); fi
gh release create "$GITHUB_REF_NAME" "$out/$asset" "$out/SHA256SUMS" "${args[@]}"
prerelease=false
if [[ "$version" == *-* ]]; then prerelease=true; fi
# A rerun of a published tag replaces its assets instead of failing.
if gh release view "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
gh release edit "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --prerelease="$prerelease"
gh release upload "$GITHUB_REF_NAME" "$out/$asset" "$out/SHA256SUMS" --repo "$GITHUB_REPOSITORY" --clobber
else
gh release create "$GITHUB_REF_NAME" "$out/$asset" "$out/SHA256SUMS" --repo "$GITHUB_REPOSITORY" --verify-tag --latest=false \
--prerelease="$prerelease" --title "Seaweed Block $version" --notes-file "$NOTES"
fi
- name: Clean job workspace
# Hosted runners are disposable; their setup-go cache upload runs in