Harden release workflow: fail fast on tag/version mismatch, tolerate re-runs#20
Merged
Merged
Conversation
A release tag pointing at a pre-bump commit silently builds the old version and fails at PyPI upload with a confusing 'File already exists'. Assert tag == built version in the build job so the mistake is caught early with an actionable message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017d8fQYnfiBRFrimcC55BLa
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.
Why
The
v0.1.5release failed to publish. Root cause: thev0.1.5tag was cut at commitc2f90e2(merge of #17), wherepyproject.tomlstill readversion = "0.1.4". The version bump to0.1.5landed onmainin the next commit (#18), after the tag. So the release builtcrumb_kit-0.1.4and PyPI rejected it with400 File already exists— 0.1.4 was already published on 6/29.The failure surfaced only at the very last step (the PyPI upload) with a confusing "already exists" message for a version nobody intended to publish. These changes make that mistake obvious and cheap to recover from.
Changes
release.yml): on areleaseevent, assert the built wheel's version equals the release tag before doing anything else. A mistagged release now fails in the build job with an actionable message ("re-tag on the bumped commit") instead of dying at the upload step.skip-existing: trueon the publish step: if a release ever half-uploads (wheel succeeds, sdist fails), a re-run skips the already-present file instead of erroring onFile already exists, so a partial failure no longer forces a version bump.Notes
crumb-kit 0.1.5was never uploaded (PyPI 404), so the version number is still free to use.main: delete the failedv0.1.5release and tag, then create a newv0.1.5release with Targetmain.🤖 Generated with Claude Code
Generated by Claude Code