fix(ci): make the GitHub Release step idempotent so same-tag retries work (#198) - #206
Merged
Conversation
…work `gh release create` has no upsert mode and fails outright when a release already exists for the tag. That step runs before "Publish to npm", so any failure at or after the publish left a real GitHub Release behind and the same-tag re-run documented in MAINTAINERS.md died at release creation instead of retrying the step that actually failed. This happened during 0.16.0, where each retry needed an undocumented `gh release delete 0.16.0 --yes` first. Detect the existing release with `gh release view` (exit 0 when present, 1 when not) and take the edit path when it is, refreshing title, notes and prerelease flag; create as before otherwise. A fresh tag behaves exactly as it did. The prerelease state is now passed as an explicit `--prerelease=true|false` instead of a bare conditional flag. The edit path requires it: a bare `--prerelease` would silently demote a stable release to a prerelease on re-run, and there is no way to say "false" without the explicit form. Also documents in MAINTAINERS.md that `npm publish` is deliberately NOT idempotent, so a re-run after a successful publish fails with EPUBLISHCONFLICT — that means the version is already on npm, not that something is broken. Closes #198 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
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.
The problem
gh release createhas no upsert mode — it fails outright if a release already exists for the tag. That step runs before "Publish to npm", so the ordering produced a trap:0.16.0 was only released by running
gh release delete 0.16.0 --yesbefore each retry, an undocumented workaround.The fix
Detect the existing release and take an edit path:
gh release viewexits 0 when the release exists and 1 when it does not — that exit code is the whole detection.Why the prerelease flag changed shape
It was a bare conditional flag (
--prereleaseor empty). The edit path cannot use that form: a bare--prereleaseon a re-run of a stable release would silently demote it to a prerelease, and there is no way to express "false" without the explicit form. So it is now--prerelease=true|false, driven by the samesteps.tag.outputs.prereleasevalue, on both paths.Verification
The workflow can't be exercised without cutting a release, so each assumption it rests on was checked directly against
gh2.97.0:gh release view <existing tag>gh release view <missing tag>gh release edit --prerelease=falsegh release create --prerelease=falserunblock extracted and checked withbash -nAcceptance criteria
elsebranch is the original command)Also documented
npm publishis deliberately not idempotent — npm refuses to republish an existing version. So a re-run after a successful publish fails with 403 /EPUBLISHCONFLICT, which means the version is already on npm rather than that something is broken. MAINTAINERS.md now says so, withnpm view @webarkit/jsfeat-next versionsas the check, so the next person doesn't misread it as a failure.Closes #198
🤖 Generated with Claude Code