The above answer is correct, but I feel its a bit incomplete. Even after adding the above commit types, the release will not be triggered on all the commit types. If you wish to trigger the release on all or selected commit types (ex. refactor
, docs
ci
etc.) you can use the configuration as below:
// release.config.js
module.exports = {
plugins: [
[
'@semantic-release/commit-analyzer',
{
preset: 'conventionalCommits',
releaseRules: [
{ type: 'revert', scope: '*', release: 'patch' },
{ type: 'docs', scope: '*', release: 'patch' },
{ type: 'style', scope: '*', release: 'patch' },
{ type: 'chore', scope: '*', release: 'patch' },
{ type: 'refactor', scope: '*', release: 'patch' },
{ type: 'test', scope: '*', release: 'patch' },
{ type: 'build', scope: '*', release: 'patch' },
{ type: 'ci', scope: '*', release: 'patch' },
{ type: 'improvement', scope: '*', release: 'patch' },
],
},
],
[
'@semantic-release/release-notes-generator',
{
preset: 'conventionalCommits',
presetConfig: {
types: [
{ type: 'feat', section: 'Features' },
{ type: 'fix', section: 'Bug Fixes' },
{ type: 'perf', section: 'Performance Improvements' },
{ type: 'revert', section: 'Reverts' },
{ type: 'docs', section: 'Documentation', hidden: false },
{ type: 'style', section: 'Styles', hidden: false },
{ type: 'chore', section: 'Miscellaneous Chores', hidden: false },
{ type: 'refactor', section: 'Code Refactors', hidden: false },
{ type: 'test', section: 'Tests', hidden: false },
{ type: 'build', section: 'Build System', hidden: false },
{ type: 'ci', section: 'CI/CD', hidden: false },
{ type: 'improvement', section: 'Improvements', hidden: false },
],
},
},
],
['@semantic-release/github'],
[
'@semantic-release/npm',
{
npmPublish: false,
},
],
'@semantic-release/changelog',
'@semantic-release/git',
],
branch: 'master',
};
Working of the above config:
@semantic-release/commit-analyzer
will trigger the release for feat
, fix
& BREAKING CHANGE
as usual. I've only added the rest of the types that are ignored by default. Needless to say that they will be considered as patches and will only bump the patch
number from semantic versioning in your tags
, release notes
, changelog
& package.json
file.
@semantic-release/release-notes-generator
will just make sure that the commits are grouped correctly based on the type
and will display my custom headings defined with the section
key.
Hope this helps someone in future!