Skip to content

Fail publish workflow when release tag and VERSION disagree#150

Merged
timlnx merged 1 commit into
masterfrom
verify-tag-matches-version
May 25, 2026
Merged

Fail publish workflow when release tag and VERSION disagree#150
timlnx merged 1 commit into
masterfrom
verify-tag-matches-version

Conversation

@timlnx
Copy link
Copy Markdown
Owner

@timlnx timlnx commented May 25, 2026

Summary

  • Today's 2.1.1 misadventure (tag pushed without bumping VERSION) shows the publish flow has no guard against the most common release-time finger-slip.
  • Add a first-step check in the build job: strip the optional v prefix off the tag and compare against cat VERSION. Fail loudly with an annotation, both values, and the standard fix recipe if they disagree.
  • Locally verified the bash:
    • v2.1.1 tag + VERSION=2.1.0 → mismatch, exit 1
    • v2.1.0 tag + VERSION=2.1.0 → ok, proceeds

Why this is the right layer

  • CI-side, not local: catches the mistake regardless of which machine cut the tag, no per-clone setup required.
  • Runs before python -m build, so no wrong-versioned artifact is ever produced or uploaded.
  • Workflow-level ::error:: annotation surfaces the failure cleanly in the GitHub Actions UI.

Test plan

  • Merge to master
  • Cut next release (2.1.1 or 2.1.2 depending on the recovery path) with VERSION bumped first; confirm green
  • Optional: deliberately mismatch in a throwaway tag to confirm the failure surface is what we want (skip if too noisy)

It is too easy to push a vX.Y.Z tag and cut a release without first
bumping the VERSION file. When that happens hatchling reads the stale
VERSION, produces a wheel/sdist for the previous version, and the
publish step tries to upload artifacts whose filenames disagree with
the release the workflow was triggered by.

Add a first-step guard in the build job that strips the optional v
prefix off the tag and compares against cat VERSION. On mismatch it
prints a workflow annotation, dumps both values, explains the usual
cause, and exits non-zero before any build or upload happens.
@timlnx
Copy link
Copy Markdown
Owner Author

timlnx commented May 25, 2026

Considering those RPM build failures as 'release-cleanup churn'. Expect those will clean up correctly after this release is stable again.

@timlnx timlnx merged commit 2dc1fb3 into master May 25, 2026
35 of 39 checks passed
@timlnx timlnx deleted the verify-tag-matches-version branch May 25, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant