-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.config.js
134 lines (132 loc) · 3.95 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
128
129
130
131
132
133
134
/**
* A configuration file for semantic-release
*
* @see {@link https://semantic-release.gitbook.io/semantic-release/} for about semantic-release.
* @see {@link https://semantic-release.gitbook.io/semantic-release/usage/configuration} for configuration details.
* @see {@link https://github.com/semantic-release/semantic-release/blob/971a5e0d16f1a32e117e9ce382a1618c8256d0d9/lib/get-config.js#L56} for about default config.
*/
// const types = require("./commit-types.config");
const defaultBranch = "main"; // or "master"
const changelogFile = "CHANGELOG.md";
module.exports = {
/**
* Git branch targeted for release
*
* @see https://semantic-release.gitbook.io/semantic-release/usage/workflow-configuration
*/
branches: [
"+([0-9])?(.{+([0-9]),x}).x",
defaultBranch,
{ name: "beta", prerelease: true },
{ name: "alpha", prerelease: true },
],
/**
* Git tag format. You can use Lodash templates.
* This setting is ignored when using multi-semantic-release.
*/
tagFormat: "v${version}",
/**
* plugin to run
*/
plugins: [
/**
* Analyze commits with conventional-changelog.
* @see https://github.com/semantic-release/commit-analyzer
*/
[
"@semantic-release/commit-analyzer",
{
// preset: "conventionalcommits",
releaseRules: [
{ breaking: true, release: "major" },
{ revert: true, release: "patch" },
// ...types.flatMap(({ type, release }) =>
// release ? [{ type, release }] : []
// ),
],
},
],
/**
* Generate changelog content with conventional-changelog.
* @see https://github.com/semantic-release/release-notes-generator
*/
[
"@semantic-release/release-notes-generator",
{
// preset: "conventionalcommits",
presetConfig: {
// types: types.map(({ type, section, hidden }) => ({
// type,
// section,
// hidden: hidden ?? true,
// })),
},
},
],
/**
* Generate a changelogFile based on the changelog contents.
* @see https://github.com/semantic-release/changelog
*/
[
"@semantic-release/changelog",
{
changelogFile,
},
],
/**
* Commit the assets generated during the release to your Git repository.
* @see https://github.com/semantic-release/git
*/
[
"@semantic-release/git",
{
// files to commit
assets: [
"package.json", // to commit changes in the version field
"package-lock.json", // to commit changes in the version field
changelogFile, // to commit changes in changelogFile
],
// commit message
message:
"release: 🏹 ${nextRelease.gitTag} [skip ci]\n\n${nextRelease.notes}",
},
],
/**
* Update package.json version or publish npm package.
* @see https://github.com/semantic-release/npm
*/
[
"@semantic-release/npm",
{
npmPublish: true,
},
],
/**
* Publish GitHub releases and leave comments on released pull requests and issues.You can also upload assets to releases.
* @see https://github.com/semantic-release/github
*/
[
"@semantic-release/github",
{
// Labels for related issues and PRs
releasedLabels: ["released", "released-in-${nextRelease.gitTag}"],
// Comments left on related issues and PRs
successComment:
"🎉 This ${issue.pull_request ? 'pull request' : 'issue'} is included in version ${nextRelease.gitTag}.",
assets: [
{"path":"dist.zip", "label":"distribution-${nextRelease.gitTag}.zip"}
]
},
],
/**
* Run shell commands at various points in the release process.
* @see https://github.com/semantic-release/exec
*/
[
"@semantic-release/exec",
{
prepareCmd: "npm run build && zip -r dist.zip dist",
},
],
],
};