Add opt-in version check to verify tag matches gem VERSION#29
Open
cseeman wants to merge 1 commit intorubygems:v1from
Open
Add opt-in version check to verify tag matches gem VERSION#29cseeman wants to merge 1 commit intorubygems:v1from
cseeman wants to merge 1 commit intorubygems:v1from
Conversation
Add a check-version input (default false) that, when enabled, verifies the git tag triggering the release matches the version in the gemspec before publishing. This prevents accidentally pushing a gem whose version does not match the release tag. The check handles common tag formats including v1.2.3, bare 1.2.3, and monorepo-style prefixes like my-gem-v1.2.3 or my-gem/v1.2.3. When the workflow is not triggered by a tag push, the check is skipped. Closes rubygems#14
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
check-versioninput (defaultfalse) that verifies the git tag matches the gemspec version before publishingv1.2.3, bare1.2.3, and monorepo-style prefixes likemy-gem-v1.2.3Justification
Prevents accidentally publishing a gem whose version does not match the release tag. This is an opt-in safeguard, so existing workflows are unaffected.
Technical Details
The check loads the gemspec via
Gem::Specification.loadto extract the version, then strips known tag prefixes (v, monorepo-stylename-vorname/v) before comparing. The step only runs whencheck-version: trueand the workflow is triggered by a tag ref.Closes #14