Skip to content

Commit 427b65b

Browse files
committed
ci: switch commit message format to conventional-commits
* https://www.conventionalcommits.org/
1 parent 6c96714 commit 427b65b

File tree

2 files changed

+35
-25
lines changed

2 files changed

+35
-25
lines changed

release-rules.js

Lines changed: 0 additions & 18 deletions
This file was deleted.

release.config.js

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
1-
module.exports = {
1+
// Commit types appear in the changelog in this order
2+
const commitTypes = [
3+
{ type: 'feat', section: 'Features' },
4+
{ type: 'fix', section: 'Bug Fixes' },
5+
{ type: 'perf', section: 'Performance Improvements' },
6+
{ type: 'revert', section: 'Reversions' },
7+
{ type: 'refactor', section: 'Code Refactoring' },
8+
{ type: 'docs', section: 'Documentation' },
9+
{ type: 'test', section: 'Testing' },
10+
{ type: 'style', section: 'Style Changes' },
11+
{ type: 'ci', section: 'Continuous Integration' },
12+
{ type: 'build', section: 'Build System' },
13+
{ type: 'chore', section: 'Maintenance' }
14+
]
15+
16+
// Default rules can be found in `github.com/semantic-release/commit-analyzer/lib/default-release-rules.js`
17+
// that cover feat, fix, perf and breaking.
18+
// Commit types defined above but without release rules do not trigger a release
19+
// but will be incorporated into the next release.
20+
// NOTE: Any changes to commit types or release rules must be reflected in `CONTRIBUTING.rst`.
21+
const releaseRules = [
22+
{ type: 'docs', release: 'patch' },
23+
{ type: 'refactor', release: 'patch' },
24+
{ type: 'revert', release: 'patch' },
25+
{ type: 'style', release: 'patch' },
26+
{ type: 'test', release: 'patch' }
27+
]
28+
29+
const config = {
230
// TODO: remove this when we no longer process releases on GitLab CI
331
repositoryUrl: 'https://github.com/saltstack-formulas/template-formula',
432
plugins: [
5-
['@semantic-release/commit-analyzer', {
6-
preset: 'angular',
7-
releaseRules: './release-rules.js'
8-
}],
33+
['@semantic-release/commit-analyzer', { releaseRules }],
934
'@semantic-release/release-notes-generator',
1035
['@semantic-release/changelog', {
1136
changelogFile: 'CHANGELOG.md',
@@ -20,7 +45,10 @@ module.exports = {
2045
}],
2146
'@semantic-release/github'
2247
],
23-
generateNotes: {
24-
preset: 'angular'
48+
preset: 'conventionalcommits',
49+
presetConfig: {
50+
types: commitTypes
2551
}
2652
}
53+
54+
module.exports = config

0 commit comments

Comments
 (0)