Custom semantic-release workflow:
- Fully automated PATCH releases.
- MINOR and MAJOR releases requre changelog.
- Custom commit convention.
- Release draft generator.
Read more in my article Automate npm releases with semantic-release and human-written change logs.
First install semantic-release.
Then:
npm install --save-dev semantic-release-tamia
Add to your package.json
:
"release": {
"analyzeCommits": "semantic-release-tamia/analyzeCommits",
"generateNotes": "semantic-release-tamia/generateNotes",
"verifyRelease": "semantic-release-tamia/verifyRelease"
}
To release a new version, you'll need to create a commit with Changelog
type. To simplify the creation of it, add to your package.json
scripts
section:
"scripts" {
"changelog:preview": "sr-changelog",
"changelog:commit": "sr-changelog commit"
}
To generate changelog draft run npm run changelog:preview
. It will create a file with all important commits for the release grouped by type (breaking changes, new features and bugfixes) and open it in your default editor.
Now you can rewrite your changelog to make it valuable for your users.
To commit changelog run npm run changelog:commit
. It will make a commit without changes (git commit --allow-empty) of type Changelog and changelog in commit message body.