-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrelease.config.cjs
More file actions
86 lines (82 loc) · 2.18 KB
/
release.config.cjs
File metadata and controls
86 lines (82 loc) · 2.18 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
const rules = [
{ type: 'feat', release: 'minor', title: '✨ Features' },
{ type: 'fix', release: 'patch', title: '🐛 Bug Fixes' },
{ type: 'perf', release: 'patch', title: '💨 Performance Improvements' },
{ type: 'refactor', release: 'patch', title: '🔄 Code Refactors' },
{ type: 'docs', release: false, title: '📚 Documentation' },
{ type: 'chore', release: false, title: '🛠️ Other changes' },
];
const isDev =
process.env.BRANCH_NAME === 'dev' || process.env.GITHUB_REF_NAME === 'dev';
const gitPlugin = isDev
? false
: [
'@semantic-release/git',
{
assets: ['package.json', 'CHANGELOG.md', 'example/package.json'],
message:
'release: ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
];
const sortMap = Object.fromEntries(
rules.map((rule, index) => [rule.title, index])
);
/**
* @type {import('semantic-release').GlobalConfig}
*/
module.exports = {
branches: ['main', { name: 'dev', channel: 'dev', prerelease: 'dev' }],
plugins: [
[
'@semantic-release/commit-analyzer',
{
preset: 'conventionalcommits',
releaseRules: [
{ breaking: true, release: 'major' },
{ revert: true, release: 'patch' },
...rules.map(({ type, release }) => ({ type, release })),
],
},
],
[
'@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',
{
changelogFile: 'CHANGELOG.md',
},
],
[
'@semantic-release/npm',
{
npmPublish: true,
tarballDir: 'release',
},
],
[
'@semantic-release/github',
{
assets: [
{
path: 'release/*.tgz',
label: 'react-native-google-maps-plus-${nextRelease.version}.tgz',
},
],
},
],
...(gitPlugin ? [gitPlugin] : []),
],
};