-
Notifications
You must be signed in to change notification settings - Fork 77
/
.releaserc.js
44 lines (42 loc) · 1.55 KB
/
.releaserc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const rules = [
{ type: 'feat', release: 'minor', title: 'New features' },
{ type: 'feature', release: 'minor', title: 'New features' },
{ type: 'fix', release: 'patch', title: 'Bug fixes' },
{ type: 'refactor', release: 'patch', title: 'Code changes' },
{ type: 'chore', release: 'patch', title: 'Other chores' },
{ type: 'docs', release: 'patch', title: 'Documentation changes' },
];
// Simple mapping to order the commit groups
const sortMap = Object.fromEntries(rules.map((rule, index) => [rule.title, index]));
module.exports = {
branches: ['main'],
tagFormat: '${version}',
plugins: [
['@semantic-release/commit-analyzer', {
preset: 'conventionalcommits',
releaseRules: [
{ breaking: true, release: 'major' },
{ revert: true, release: 'patch' },
].concat(
rules.map(({ type, release, breaking }) => ({ type, release, breaking }))
),
}],
['@semantic-release/release-notes-generator', {
preset: 'conventionalcommits',
presetConfig: {
types: rules.map(({ type, title }) => ({ type, section: title })),
},
writerOpts: {
commitGroupsSort: (a, z) => sortMap[a.title] - sortMap[z.title],
},
}],
'@semantic-release/changelog',
['@semantic-release/npm', { npmPublish: false }],
["@semantic-release/exec", { publishCmd: 'yarn build' }],
['@semantic-release/git', {
message: 'chore: create new release ${nextRelease.version}\n\n${nextRelease.notes}',
assets: ['package.json', 'CHANGELOG.md', 'build/*'],
}],
'@semantic-release/github',
],
};