Skip to content

Publish from a tag on main, taking the version from the tag - #46

Merged
forrestlinfeng merged 1 commit into
mainfrom
publish-from-tag
Oct 17, 2026
Merged

forrestlinfeng merged 1 commit into
mainfrom
publish-from-tag

Conversation

@forrestlinfeng

@forrestlinfeng forrestlinfeng commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Releasing took two steps that did two different things: a PR to bump package.json, then a tag to publish. Now the tag alone is the release.

To release, tag a commit on main and push the tag:

git tag v0.2.2 origin/main
git push origin v0.2.2

What changes in publish.yml:

  • Check the tag is on main (new): a tag pointing at a commit not reachable from origin/main fails before anything runs. Checkout now uses fetch-depth: 0 so origin/main is there to compare against.
  • Take the version from the tag (replaces "Check the tag matches the manifest version"): npm version <tag> --no-git-tag-version writes the tag's version into package.json inside the job, so the published tarball carries it. A tag that is not valid semver fails here.
  • Check this version is not already on npm now runs only for tags. The repo's package.json version is no longer bumped, so on a manual rehearsal run it would always be "already published".

The repo's package.json stays at 0.2.1 from here on; npm and /evolver-status (which reads the installed package's own package.json) show the tagged version.

Rehearsed with a manual run on this branch.

🤖 Generated with Claude Code


Note

Medium Risk
Changes npm publish gates and how version is chosen at release time; mistakes in tagging or the main-ancestor check could block or mis-version publishes, but duplicate-version and main-line checks limit exposure.

Overview
Release is now tag-driven: pushing a v* tag on main publishes to npm; the repo’s package.json version is no longer bumped per release.

The Publish workflow now fetches full git history (fetch-depth: 0), rejects tags whose commit is not on origin/main, and sets the package version from the tag via npm version in the job (replacing the old check that package.json had to match the tag). The “already on npm” guard runs only on tag pushes so manual workflow_dispatch rehearsals don’t fail against the stale manifest version.

Manual runs still build and test without publishing.

Reviewed by Cursor Bugbot for commit beb52fd. Bugbot is set up for automated code reviews on this repo. Configure here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@forrestlinfeng
forrestlinfeng merged commit bba59d1 into main Oct 17, 2026
10 checks passed
@forrestlinfeng
forrestlinfeng deleted the publish-from-tag branch October 17, 2026 23:31
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