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