ci(release): fail when the tag and package.json version disagree - #180
Open
myselfsiddharth wants to merge 2 commits into
Open
ci(release): fail when the tag and package.json version disagree#180myselfsiddharth wants to merge 2 commits into
myselfsiddharth wants to merge 2 commits into
Conversation
The tag decides when to publish; package.json decides what version is published. Nothing tied the two together, so `git tag v0.2.0` on a tree still saying 0.1.0 would publish 0.1.0 under a tag claiming otherwise — or fail at the registry as "already published", after the token had already been used. Found while pre-flighting the first release: a stale `v0.1.0` tag from 2026-08-09 already exists on main (commit 90f66c6, well behind current HEAD), and it predates release.yml, so it never fired. Whoever cuts the real release has to pick a new version, which is exactly the situation this guard covers. Verified both branches locally against the real package.json: v0.1.0 passes, v0.2.0 refuses. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
Pre-flighting the first npm release turned up a gap in
.github/workflows/release.yml(added in #174, never yet run): nothing checks that the pushed tag matches the version inpackage.json.The tag decides when to publish;
package.jsondecides what gets published. Taggingv0.2.0on a tree that still says0.1.0would publish 0.1.0 under a tag claiming 0.2.0 — or fail at the registry as "already published", after the token had already been used. This adds a step that fails before the registry call, while it is still free to fix.Why this comes up now
There is already a stale
v0.1.0tag onmainfrom 2026-08-09 (commit90f66c6, far behind currentHEAD). It predatesrelease.yml, so it never triggered a run. Whoever cuts the first real release therefore has to either retag or bump — exactly the case this guard protects.Test plan
v0.1.0+package.json0.1.0→publishing 0.1.0 from tag v0.1.0v0.2.0+package.json0.1.0→ exits 1 with both versions named\.envis an unanchored regex, but no file in the 179-file tarball containsenvat allnpm pack --dry-runshipsdist/src/,contracts/,README.md,LICENSE;dist/src/cli.jshas its#!/usr/bin/env nodeshebang--provenancewill work;id-token: writeis already set