-
Notifications
You must be signed in to change notification settings - Fork 7
/
release.config.js
127 lines (121 loc) · 3.2 KB
/
release.config.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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
const {promisify} = require('util')
const readFileAsync = promisify(require('fs').readFile)
const template = readFileAsync('.github/templates/template.hbs')
const commitTemplate = readFileAsync('.github/templates/commit-template.hbs')
const sections = [
{
group: 'breaking_changes',
label: ':boom: Breaking Changes',
emojis: ['💥'],
},
{
group: 'sparkles',
label: ':sparkles: New',
emojis: ['✨', '🎉'],
},
{
group: 'changed',
label: ':recycle: Changes',
emojis: ['🎨', '✏️', '⚡️', '♻️', '🔧', '👽️', '🚚', '🍱', '♿️', '💬', '🗃️', '🚸', '🏗️', '📱', '🔥', '🏷️'],
},
{
group: 'fixed',
label: ':bug: Bugs',
emojis: ['🐛', '🚑️'],
},
{
group: 'dependencies',
label: ':arrow_up: Dependencies',
emojis: ['⬆️', '⬇️', '➕', '➖', '📌'],
},
{
group: 'docs',
label: ':memo: Documentation',
emojis: ['📝', '🔇'],
},
{
group: 'other',
label: ':seedling: Other',
emojis: ['🔒️', '🔐', '👷', '💄'],
},
];
function makeGroups(commits) {
if (!commits.length) return []
function mapCommits(groups) {
return groups
.map(({group, emojis, label}) => ({
group,
label,
is_dep: group === 'dependencies',
commits: commits
.filter((commit) => emojis.indexOf(commit.gitmoji) >= 0)
.sort((first, second) => new Date(second.committerDate) - new Date(first.committerDate)),
}))
.filter(group => group.commits.length);
}
return mapCommits(sections)
}
module.exports = {
branches: ["main", {name: "develop", prerelease: "rc"}],
tagFormat: "v${version}",
plugins: [
[
'semantic-release-gitmoji',
{
releaseRules: {
patch: {
include: [...sections[2].emojis, ...sections[3].emojis, ...sections[4].emojis, ...sections[5].emojis, ...sections[6].emojis],
exclude: ['⬆️', '📝'],
},
},
releaseNotes: {
template,
partials: {commitTemplate},
helpers: {
sections: (commits) => {
let flat_commits = [];
for (const [, value] of Object.entries(commits)) {
flat_commits.push(...value);
}
return makeGroups(flat_commits);
},
split_by_line: (text) => text.split('\n'),
},
}
}
],
[
"@semantic-release/changelog",
{
changelogFile: "CHANGELOG.md",
changelogTitle: '# Changelog',
},
],
[
"@semantic-release/exec",
{
prepareCmd:
"poetry version ${nextRelease.version} && " +
"poetry build",
publishCmd: "poetry publish",
},
],
[
"@semantic-release/git",
{
assets: ["CHANGELOG.md", "pyproject.toml"],
message: [
':bookmark: v${nextRelease.version} [skip ci]',
'',
'https://github.com/mom1/api-client-pydantic/releases/tag/${nextRelease.gitTag}'
].join('\n')
},
],
[
"@semantic-release/github",
{
assets: [{path: "dist/*.whl"}, {path: "dist/*.tar.gz"}],
},
],
],
};