This project uses an automated release system that handles versioning, testing, git tagging, GitHub releases, and npm publishing.
npm run release patch # 0.1.0 -> 0.1.1 (bug fixes)
npm run release minor # 0.1.0 -> 0.2.0 (new features)
npm run release major # 0.1.0 -> 1.0.0 (breaking changes)
npm run release 0.2.0 # Set specific version- Bumps version in
package.json - Runs build and tests to ensure everything works
- Creates git tag (e.g.,
v0.1.1) - Pushes to GitHub (commits and tags)
- Creates GitHub release with auto-generated release notes
- Publishes to npm (if authentication is configured)
-
npm authentication (one of these):
npm login(with 2FA OTP)npm token create --read-only=falsethennpm config set //registry.npmjs.org/:_authToken YOUR_TOKEN- Set
NPM_TOKENenvironment variable
-
GitHub CLI (
gh) authenticated:gh auth login
-
Add
NPM_TOKENsecret to your GitHub repository:- Go to: Settings → Secrets and variables → Actions
- Add secret:
NPM_TOKEN= (your npm token)
-
Run the workflow:
- Go to: Actions → Release → Run workflow
- Select version type (patch/minor/major)
- Click "Run workflow"
- patch: Bug fixes, small improvements (0.1.0 → 0.1.1)
- minor: New features, backwards compatible (0.1.0 → 0.2.0)
- major: Breaking changes (0.1.0 → 1.0.0)
If the automated script fails at any step, you can complete it manually:
# 1. Bump version
npm version patch # or minor, major
# 2. Run tests
npm run build
# 3. Create and push tag
git tag v0.1.1
git push origin v0.1.1
# 4. Create GitHub release
gh release create v0.1.1 --title "v0.1.1" --notes "Release notes"
# 5. Publish to npm
npm publishSolution: Create an npm token and configure it:
npm token create --read-only=false
npm config set //registry.npmjs.org/:_authToken YOUR_TOKENOr use environment variable:
export NPM_TOKEN=your_token_here
npm run release patchSolution: Ensure GitHub CLI is authenticated:
gh auth loginSolution: The script will detect this and skip npm publish. Just bump to the next version:
npm run release patch # Will create 0.1.2 if 0.1.1 existsThe GitHub Actions workflow (.github/workflows/release.yml) allows you to create releases from the GitHub UI:
- Go to Actions tab
- Select "Release" workflow
- Click "Run workflow"
- Choose version type
- Click "Run workflow" button
The workflow will:
- Run all tests
- Create git tag
- Create GitHub release
- Publish to npm
All automatically! 🚀