From 5fa8dde04fc6e279ba1d0f5c2073d504ca4f617d Mon Sep 17 00:00:00 2001 From: Ralf Anton Beier Date: Wed, 29 Apr 2026 22:10:40 +0200 Subject: [PATCH] fix(ci): make Release workflow idempotent on existing tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "Create Release" step in release.yml runs `gh release create $VERSION ...` unconditionally. This fails with "a release with the same tag name already exists" if a maintainer ran `gh release create` manually right after pushing the tag — which is exactly what happened on every release in the v0.5.0 / v0.5.1 / v0.6.0 sequence. Net effect: the release page exists with the changelog notes but has no binary / VSIX / SHA256 assets attached. Fix: make the step idempotent. If `gh release view $VERSION` succeeds (release already exists), `gh release upload --clobber` the built assets to the existing release. Otherwise create it the normal way. `--clobber` lets a re-run overwrite assets that a previous failed attempt partially uploaded — also useful when re-running the workflow via workflow_dispatch to backfill assets on an old release. Backfill plan: after this lands, re-run the Release workflow on v0.5.0, v0.5.1, v0.6.0 via workflow_dispatch (or push a no-op tag update). Each run will detect the existing release and upload the binaries that were built but never published. Trace: skip --- .github/workflows/release.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7d315c0..770f4661 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -281,15 +281,27 @@ jobs: sha256sum * > SHA256SUMS.txt cat SHA256SUMS.txt - - name: Create Release + - name: Create or update Release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | VERSION="${GITHUB_REF#refs/tags/}" - gh release create "$VERSION" \ - --title "Rivet $VERSION" \ - --generate-notes \ - release/* + # Idempotent: if a release already exists for this tag (e.g. + # the maintainer ran `gh release create` manually after pushing + # the tag), upload assets to the existing release. Otherwise + # create the release with assets. `--clobber` lets re-runs + # overwrite assets that a previous failed attempt partially + # uploaded. + if gh release view "$VERSION" >/dev/null 2>&1; then + echo "::notice::Release $VERSION already exists; uploading assets" + gh release upload "$VERSION" --clobber release/* + else + echo "::notice::Creating Release $VERSION with assets" + gh release create "$VERSION" \ + --title "Rivet $VERSION" \ + --generate-notes \ + release/* + fi # ── Publish VS Code Extension to Marketplace ────────────────────────── # Runs after create-release so the VSIX is always on the Release page