diff --git a/release-rules.js b/release-rules.js deleted file mode 100644 index 1093d1f9..00000000 --- a/release-rules.js +++ /dev/null @@ -1,18 +0,0 @@ -// No release is triggered for the types commented out below. -// Commits using these types will be incorporated into the next release. -// -// NOTE: Any changes here must be reflected in `CONTRIBUTING.md`. -module.exports = [ - { breaking: true, release: 'major' }, - // {type: 'build', release: 'patch'}, - // {type: 'chore', release: 'patch'}, - // {type: 'ci', release: 'patch'}, - { type: 'docs', release: 'patch' }, - { type: 'feat', release: 'minor' }, - { type: 'fix', release: 'patch' }, - { type: 'perf', release: 'patch' }, - { type: 'refactor', release: 'patch' }, - { type: 'revert', release: 'patch' }, - { type: 'style', release: 'patch' }, - { type: 'test', release: 'patch' } -] diff --git a/release.config.js b/release.config.js index 937dd03b..f60255db 100644 --- a/release.config.js +++ b/release.config.js @@ -1,11 +1,36 @@ -module.exports = { +// Commit types appear in the changelog in this order +const commitTypes = [ + { type: 'feat', section: 'Features' }, + { type: 'fix', section: 'Bug Fixes' }, + { type: 'perf', section: 'Performance Improvements' }, + { type: 'revert', section: 'Reversions' }, + { type: 'refactor', section: 'Code Refactoring' }, + { type: 'docs', section: 'Documentation' }, + { type: 'test', section: 'Testing' }, + { type: 'style', section: 'Style Changes' }, + { type: 'ci', section: 'Continuous Integration' }, + { type: 'build', section: 'Build System' }, + { type: 'chore', section: 'Maintenance' } +] + +// Default rules can be found in `github.com/semantic-release/commit-analyzer/lib/default-release-rules.js` +// that cover feat, fix, perf and breaking. +// Commit types defined above but without release rules do not trigger a release +// but will be incorporated into the next release. +// NOTE: Any changes to commit types or release rules must be reflected in `CONTRIBUTING.rst`. +const releaseRules = [ + { type: 'docs', release: 'patch' }, + { type: 'refactor', release: 'patch' }, + { type: 'revert', release: 'patch' }, + { type: 'style', release: 'patch' }, + { type: 'test', release: 'patch' } +] + +const config = { // TODO: remove this when we no longer process releases on GitLab CI repositoryUrl: 'https://github.com/saltstack-formulas/template-formula', plugins: [ - ['@semantic-release/commit-analyzer', { - preset: 'angular', - releaseRules: './release-rules.js' - }], + ['@semantic-release/commit-analyzer', { releaseRules }], '@semantic-release/release-notes-generator', ['@semantic-release/changelog', { changelogFile: 'CHANGELOG.md', @@ -20,7 +45,10 @@ module.exports = { }], '@semantic-release/github' ], - generateNotes: { - preset: 'angular' + preset: 'conventionalcommits', + presetConfig: { + types: commitTypes } } + +module.exports = config