Make release workflow idempotent on duplicate tag-push deliveries#95
Merged
Conversation
Observed on v0.3.1: a single `git push origin v0.3.1` produced two parallel "Release" workflow runs (webhook re-delivery race). Both goreleaser jobs raced on asset upload; the loser failed with `422 already_exists` on every asset. The release itself was fine but the failed run is visible noise. Two changes, both required: 1. Concurrency group `release-<ref>` with `cancel-in-progress: false` so simultaneous runs for the same tag are serialized instead of racing. We do not cancel-in-progress because a real publish must not be interrupted mid-upload. 2. Pre-flight `gh release view` check before invoking goreleaser. If a release for the tag already exists (i.e. an earlier run for the same tag already published), skip goreleaser and let the job exit green. The concurrency lock guarantees the existence check happens AFTER the first run completes, so this is reliable. Either change alone is insufficient: serialization without idempotency still produces a `422` on the second run; idempotency without serialization races because the release is created ~25s into the first run, after the second run's pre-check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Observed during the v0.3.1 cut: a single
git push origin v0.3.1produced two parallel "Release" workflow runs (25805331860 and 25805336177) — webhook re-delivery race. Both goreleaser jobs raced on asset upload; the loser failed with422 already_existson every asset. The release itself was fine, but the failed run is visible noise on the Actions tab.Fix
Two changes to
.github/workflows/release.yml, both required:release-<ref>withcancel-in-progress: false— serializes simultaneous runs for the same tag. Do not cancel-in-progress because a real publish must not be interrupted mid-upload.gh release viewcheck before goreleaser — if a release for the tag already exists, skip goreleaser and let the job exit green. Combined with the concurrency lock, the duplicate run reliably becomes a no-op.Either change alone is insufficient:
422on the second run.Test plan
🤖 Generated with Claude Code