forked from expo/expo-preview-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.releaserc.js
50 lines (48 loc) · 1.46 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
45
46
47
48
49
50
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/git',
{
message: 'chore: create new release ${nextRelease.version}\n\n${nextRelease.notes}',
assets: ['package.json', 'CHANGELOG.md'],
},
],
'@semantic-release/github',
],
};