This project has been successfully migrated to use semantic-release for automated releases.
{
"devDependencies": {
"semantic-release": "^24.2.9",
"@semantic-release/changelog": "^6.0.3",
"@semantic-release/git": "^10.0.1",
"@semantic-release/github": "^11.0.6",
"@semantic-release/npm": "^12.0.2",
"@commitlint/cli": "^20.1.0",
"@commitlint/config-conventional": "^20.0.0"
}
}.releaserc.json- semantic-release configuration.commitlintrc.json- Commit message validationMIGRATION_TO_SEMANTIC_RELEASE.md- Migration guideSETUP_COMPLETE.md- This file
-
.github/workflows/publish-npm.yml- Changed trigger from
tagstopush to main - Now runs
semantic-releaseinstead of manual npm publish
- Changed trigger from
-
.github/workflows/publish-npm-manual.yml- Marked as deprecated (kept as fallback)
-
package.json- Added
semantic-releasescript - Added
CHANGELOG.mdto files array
- Added
-
README.md- Added semantic-release badge
- Added commit message convention section
-
RELEASE.md- Complete rewrite with semantic-release workflow
- Removed manual release instructions
- Added commit convention examples
-
scripts/release.sh- Replaced with deprecation notice
# 1. Make changes
vim src/index.ts
# 2. Commit with conventional format
git add .
git commit -m "feat(api): add custom timeout option"
# 3. Push to main
git push origin main
# 4. Done! 🎉
# semantic-release automatically:
# - Bumps version (3.0.0 → 3.1.0)
# - Updates CHANGELOG.md
# - Publishes to npm
# - Creates GitHub Release
# - Commits changes back to main<type>(<scope>): <subject>
<body>
<footer>
Types that trigger releases:
fix:→ Patch release (1.0.0 → 1.0.1)feat:→ Minor release (1.0.0 → 1.1.0)perf:→ Patch releaserefactor:→ Patch release (custom config)style:→ Patch release (custom config)BREAKING CHANGE:→ Major release (1.0.0 → 2.0.0)
Types that don't trigger releases:
docs:chore:test:ci:build:
# Patch release
git commit -m "fix(validation): correct bank code validation"
# Minor release
git commit -m "feat(locale): add French language support"
# Major release (breaking change)
git commit -m "feat(api)!: redesign SDK initialization
BREAKING CHANGE: Changed from class-based to factory function pattern.
See migration guide for details."You can test what semantic-release would do without publishing:
# Dry run
npx semantic-release --dry-run
# This will show:
# - What version would be released
# - What commits would be included
# - What would be in the changelog{
"branches": ["main"],
"plugins": [
"@semantic-release/commit-analyzer", // Analyzes commits
"@semantic-release/release-notes-generator", // Generates release notes
"@semantic-release/changelog", // Updates CHANGELOG.md
"@semantic-release/npm", // Publishes to npm
"@semantic-release/github", // Creates GitHub Release
"@semantic-release/git" // Commits updated files
]
}You can optionally set up git hooks to validate commit messages:
# Install husky for git hooks
npm install --save-dev husky
# Initialize husky
npx husky init
# Add commit-msg hook
echo "npx --no-install commitlint --edit \$1" > .husky/commit-msg
chmod +x .husky/commit-msgThis will validate commit messages before they're committed.
Make sure these secrets are set in your GitHub repository:
-
NPM_TOKEN- Your npm automation token- Go to: Settings → Secrets and variables → Actions
- This should already be set up from before
-
GITHUB_TOKEN- Automatically provided by GitHub Actions- No action needed
RELEASE.md- Complete release guideMIGRATION_TO_SEMANTIC_RELEASE.md- Migration detailsREADME.md- Updated with commit conventions- semantic-release docs
- Conventional Commits
- Review the configuration - Check
.releaserc.jsonif you want to customize - Read RELEASE.md - Detailed workflow documentation
- Practice commits - Start using conventional commit format
- Test it out - Make a commit and push to see it in action!
| Action | Command |
|---|---|
| Bug fix (patch) | git commit -m "fix: ..." |
| New feature (minor) | git commit -m "feat: ..." |
| Breaking change (major) | Add BREAKING CHANGE: in footer |
| No release | git commit -m "docs: ..." or chore: ... |
| Test semantic-release | npx semantic-release --dry-run |
| Manual publish (emergency) | npm run build && npm publish |
- Version in package.json - Don't edit manually! semantic-release manages it.
- CHANGELOG.md - Auto-generated, don't edit manually.
- Commit messages - Follow the convention, they determine releases!
- Main branch - Only pushes to
maintrigger releases.
Check your commits - only certain types trigger releases:
- ✅
fix:,feat:,perf:,refactor:,style: - ❌
docs:,chore:,test:,ci:
- Check GitHub Actions logs
- Verify
NPM_TOKENsecret is set - Ensure npm account has publish permissions
Add [skip ci] to your commit message:
git commit -m "docs: update readme [skip ci]"Your repository is now configured for fully automated releases!
Just commit with conventional format and push to main. semantic-release will handle everything else.
Happy releasing! 🚀
Questions? Read RELEASE.md or visit the semantic-release documentation.