ci(publish): fail fast on tag/version mismatch (fix v0.0.4 PyPI release) - #3
Merged
Conversation
The v0.0.4 PyPI release failed because the release tag pointed at a commit where pyproject.toml still read version 0.0.3 (the bump landed in a later commit). The workflow built a duplicate 0.0.3, which PyPI rejected with 'file already exists'. Add a pre-build step that compares the release tag against the version declared in pyproject.toml and fails with a clear message when they do not match, instead of producing a confusing downstream PyPI 400.
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.
Problem
The
v0.0.4release failed to publish to PyPI. The release tagv.0.0.4was cut at commitd81e248, wherepyproject.tomlstill readversion = "0.0.3"— the actual version bump to0.0.4landed in a later commit (a407185). The publish workflow checked out the tag, builtposnoise-0.0.3, and PyPI rejected it with "file already exists" (0.0.3 was already published).Verified locally by building the package at the tag:
pyproject.tomlat tagThe first three tags are all correctly aligned; only
v.0.0.4is broken. (Also confirmed the pattern-list.txtdata files ARE correctly bundled in the wheel — packaging/data files are not the issue.)Fix
Add a pre-build step to
.github/workflows/python-publish.ymlthat compares the release tag against the version declared inpyproject.tomland fails fast with a clear message when they do not match — instead of building a duplicate and getting a confusing downstream PyPI 400.A PR cannot move a remote git tag, so the broken
v.0.0.4tag still needs to be corrected separately (by the maintainer) before re-publishing:Then delete the failed GitHub release and create a new release from the corrected tag — this re-triggers the publish workflow. With this PR merged, the new workflow step will confirm alignment before building.