mit einem Klick
release
// Prepare and publish a new release — bump versions, generate changelog, tag, and push for CI to publish to npm.
// Prepare and publish a new release — bump versions, generate changelog, tag, and push for CI to publish to npm.
| name | release |
| description | Prepare and publish a new release — bump versions, generate changelog, tag, and push for CI to publish to npm. |
Prepare and ship a new version of argue packages.
git status shows no uncommitted changes)master branchnpm run ci && npm run format:check)If any pre-condition fails, fix it before proceeding. Do NOT skip checks.
Run these commands and record the output:
# Current unified version (root is the source of truth)
node -e "import('./package.json',{with:{type:'json'}}).then(m=>console.log('workspace:',m.default.version))"
# Last release tag
git tag -l 'v*' --sort=-v:refname | head -1
# Commits since last tag (or all if no tag)
LAST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -1)
if [ -n "$LAST_TAG" ]; then
git log "$LAST_TAG"..HEAD --oneline
else
git log --oneline
fi
Based on the commits gathered above, determine the semver bump:
| Commit pattern | Bump |
|---|---|
fix: / perf: / refactor: only | patch |
Any feat: | minor |
BREAKING CHANGE in body or !: in type | major |
All workspace packages share one version number. Pick the highest bump level across all commits.
Present the decision to the user:
Current version: X.Y.Z Commits since last release: (count) Suggested bump: patch/minor/major -> X.Y.Z
Proceed?
Wait for confirmation. The user may override the version.
node scripts/bump-version.mjs X.Y.Z
npm install
This updates version in the root package.json and every packages/*/package.json, and rewrites @onevcat/argue-cli and @onevcat/argue-viewer's internal dependency on @onevcat/argue to ^X.Y.Z.
Read the current CHANGELOG.md (create if it doesn't exist). Prepend a new section at the top (after the # Changelog heading).
Format:
## [X.Y.Z] - YYYY-MM-DD
### Features
- description of feat commit (short-hash)
### Fixes
- description of fix commit (short-hash)
### Other
- description of chore/refactor/docs/etc commit (short-hash)
Rules:
npm run release:check
This runs typecheck + tests + build + smoke pack. If it fails, fix the issue before proceeding.
git add -A
git commit -m "release: vX.Y.Z"
git tag vX.Y.Z
git push && git push --tags
After push, GitHub Actions detects the tag and publishes both @onevcat/argue and @onevcat/argue-cli to npm. argue-viewer is private: true and stays local.
Publish the GitHub Release page for the freshly pushed tag, using the changelog section generated in Step 4 as the release notes:
node scripts/publish-github-release.mjs
The script reads the version from root package.json, extracts the topmost ## [X.Y.Z] - ... section from CHANGELOG.md, verifies its heading matches the version being released, and runs gh release create vX.Y.Z --title vX.Y.Z --notes <section>. You can also pass an explicit version: node scripts/publish-github-release.mjs X.Y.Z.
Notes:
git push --tags, even before the npm workflow finishes.Release.tag_name already exists. To overwrite, delete it first via gh release delete vX.Y.Z --yes and re-run, or update notes manually with gh release edit vX.Y.Z --notes-file <(awk '/^## \[/{n++; if(n==2)exit} n==1{print}' CHANGELOG.md).git tag -d vX.Y.Z && git push --delete origin vX.Y.Z), fix the issue, then re-tag.@onevcat/argue first and then @onevcat/argue-cli. If the CLI publish fails after the lib already went out, bump to the next patch and re-release — the lib publish step is idempotent (npm rejects duplicate versions, which is fine).