From a clean main, fully up to date:
git checkout main
git pull
npm run releasenpm run release bumps package.json (patch), creates a commit and a vX.Y.Z tag, and pushes both. The tag push triggers .github/workflows/release.yml, which builds, tests, publishes to npm, and creates a GitHub Release.
# minor bump (new feature, e.g. 2.1.0 → 2.2.0)
npm run release:minor
# major bump (breaking change, e.g. 2.1.0 → 3.0.0)
npm run release:majorEach script bumps package.json, creates a commit and vX.Y.Z tag, and pushes both — same flow as npm run release, just with a different version segment.
git status— working tree cleangit branch --show-current— onmaingit pull— up to date with origin- CI green on the latest
maincommit
npm version refuses to run on a dirty tree, which is the main guardrail.
- Workflow fails after publish succeeded (e.g. release-creation step): the npm version is live; create the GitHub release manually:
gh release create vX.Y.Z --generate-notes
- Workflow fails before publish: fix the issue, delete the tag locally and remotely, then bump to the next patch:
git tag -d vX.Y.Z git push origin :refs/tags/vX.Y.Z