Using conventionalcommits Preset with semantic-release
Configure semantic-release with the conventionalcommits preset instead of the default angular preset. Customize commit type to release mapping and release notes formatting.
Detailed Explanation
The conventionalcommits Preset
While semantic-release defaults to the Angular commit convention, the conventionalcommits preset provides more flexibility in configuring which commit types trigger releases and how release notes are formatted.
Configuration
{
"branches": ["main"],
"plugins": [
["@semantic-release/commit-analyzer", {
"preset": "conventionalcommits",
"releaseRules": [
{"type": "feat", "section": "Features", "release": "minor"},
{"type": "fix", "section": "Bug Fixes", "release": "patch"},
{"type": "perf", "section": "Performance", "release": "patch"},
{"type": "revert", "section": "Reverts", "release": "patch"},
{"type": "docs", "section": "Documentation", "release": false},
{"type": "style", "release": false},
{"type": "chore", "release": false},
{"type": "refactor", "section": "Refactoring", "release": false},
{"type": "test", "section": "Tests", "release": false},
{"type": "build", "section": "Build System", "release": false},
{"type": "ci", "section": "CI", "release": false}
]
}],
["@semantic-release/release-notes-generator", {
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{"type": "feat", "section": "Features", "hidden": false},
{"type": "fix", "section": "Bug Fixes", "hidden": false},
{"type": "perf", "section": "Performance", "hidden": false},
{"type": "revert", "section": "Reverts", "hidden": false},
{"type": "docs", "section": "Documentation", "hidden": true},
{"type": "style", "section": "Styles", "hidden": true},
{"type": "chore", "section": "Miscellaneous", "hidden": true},
{"type": "refactor", "section": "Code Refactoring", "hidden": true},
{"type": "test", "section": "Tests", "hidden": true},
{"type": "build", "section": "Build System", "hidden": true},
{"type": "ci", "section": "CI", "hidden": true}
]
}
}],
"@semantic-release/npm",
"@semantic-release/github"
]
}
Angular vs conventionalcommits
| Feature | angular | conventionalcommits |
|---|---|---|
| Section customization | Limited | Full control |
| Hidden types | Not configurable | hidden property |
| Scope filtering | Basic | Advanced |
| Breaking change format | Footer only | Header (!) and footer |
Section Configuration
The presetConfig.types array in the release-notes-generator controls which commit types appear in the release notes and under which section heading. Set hidden: true to exclude types from release notes even though they were analyzed.
Use Case
Teams that want full control over how release notes are formatted and which commit types appear in the changelog, or projects migrating from other versioning tools that use different section headings.
Try It — Semantic Release Config Builder
Related Topics
Custom Commit Type Release Rules for semantic-release
Advanced Configuration
Basic npm Package Release with semantic-release
Basic Configuration
Automatic Changelog Generation with semantic-release
Basic Configuration
Scope-Based Release Rules in semantic-release
Specialized Configuration
Commit Release Artifacts Back to Repository
Advanced Configuration