From d216bfda15876aaf6b87fee1f0ca016e7a075832 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sat, 5 Dec 2026 04:07:23 -0800 Subject: [PATCH] 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 --- .github/block/scripts/block-ci-port-test.py | 1 + .github/workflows/block-release.yml | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/block/scripts/block-ci-port-test.py b/.github/block/scripts/block-ci-port-test.py index b897ade959..8820b0454e 100644 --- a/.github/block/scripts/block-ci-port-test.py +++ b/.github/block/scripts/block-ci-port-test.py @@ -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) diff --git a/.github/workflows/block-release.yml b/.github/workflows/block-release.yml index 2c9e745f55..cab8bd0558 100644 --- a/.github/workflows/block-release.yml +++ b/.github/workflows/block-release.yml @@ -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