semantic-release 20.0.0-beta.3 → 20.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -5
- package/bin/semantic-release.js +9 -9
- package/cli.js +31 -31
- package/docs/developer-guide/js-api.md +46 -37
- package/docs/developer-guide/plugin.md +97 -93
- package/docs/extending/plugins-list.md +8 -7
- package/docs/extending/shareable-configurations-list.md +2 -0
- package/docs/recipes/ci-configurations/README.md +1 -0
- package/docs/recipes/ci-configurations/github-actions.md +6 -3
- package/docs/recipes/ci-configurations/gitlab-ci.md +2 -3
- package/docs/recipes/git-hosted-services/README.md +1 -0
- package/docs/recipes/git-hosted-services/git-auth-ssh-keys.md +4 -1
- package/docs/recipes/release-workflow/README.md +1 -0
- package/docs/recipes/release-workflow/distribution-channels.md +1 -0
- package/docs/recipes/release-workflow/maintenance-releases.md +1 -0
- package/docs/recipes/release-workflow/pre-releases.md +1 -0
- package/docs/support/FAQ.md +25 -14
- package/docs/support/troubleshooting.md +1 -0
- package/docs/usage/ci-configuration.md +4 -3
- package/docs/usage/configuration.md +8 -2
- package/docs/usage/plugins.md +11 -5
- package/docs/usage/workflow-configuration.md +29 -17
- package/index.js +75 -72
- package/lib/get-commits.js +15 -9
- package/lib/get-config.js +38 -38
- package/lib/get-error.js +4 -4
- package/lib/get-git-auth-url.js +32 -32
- package/lib/get-last-release.js +8 -8
- package/lib/get-logger.js +10 -10
- package/lib/get-next-version.js +11 -11
- package/lib/get-release-to-add.js +17 -17
- package/lib/git.js +41 -41
- package/lib/hide-sensitive.js +6 -6
- package/lib/utils.js +12 -12
- package/lib/verify.js +14 -14
- package/package.json +6 -13
package/README.md
CHANGED
|
@@ -56,10 +56,10 @@ Tools such as [commitizen](https://github.com/commitizen/cz-cli) or [commitlint]
|
|
|
56
56
|
|
|
57
57
|
The table below shows which commit message gets you which release type when `semantic-release` runs (using the default configuration):
|
|
58
58
|
|
|
59
|
-
| Commit message | Release type
|
|
60
|
-
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
61
|
-
| `fix(pencil): stop graphite breaking when too much pressure applied` | ~~Patch~~ Fix Release
|
|
62
|
-
| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release
|
|
59
|
+
| Commit message | Release type |
|
|
60
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| `fix(pencil): stop graphite breaking when too much pressure applied` | ~~Patch~~ Fix Release |
|
|
62
|
+
| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release |
|
|
63
63
|
| `perf(pencil): remove graphiteWidth option`<br><br>`BREAKING CHANGE: The graphiteWidth option has been removed.`<br>`The default graphite width of 10mm is always used for performance reasons.` | ~~Major~~ Breaking Release <br /> (Note that the `BREAKING CHANGE: ` token must be in the footer of the commit) |
|
|
64
64
|
|
|
65
65
|
### Automation with CI
|
|
@@ -145,7 +145,6 @@ Let people know that your package is published using **semantic-release** and wh
|
|
|
145
145
|
|
|
146
146
|
```md
|
|
147
147
|
[](https://github.com/semantic-release/semantic-release)
|
|
148
|
-
|
|
149
148
|
```
|
|
150
149
|
|
|
151
150
|
## Team
|
package/bin/semantic-release.js
CHANGED
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
/* eslint-disable no-var */
|
|
4
4
|
|
|
5
|
-
import semver from
|
|
6
|
-
import { execa } from
|
|
7
|
-
import findVersions from
|
|
8
|
-
import cli from
|
|
9
|
-
import {createRequire} from
|
|
5
|
+
import semver from "semver";
|
|
6
|
+
import { execa } from "execa";
|
|
7
|
+
import findVersions from "find-versions";
|
|
8
|
+
import cli from "../cli.js";
|
|
9
|
+
import { createRequire } from "node:module";
|
|
10
10
|
|
|
11
11
|
const require = createRequire(import.meta.url);
|
|
12
|
-
const { engines } = require(
|
|
12
|
+
const { engines } = require("../package.json");
|
|
13
13
|
const { satisfies, lt } = semver;
|
|
14
14
|
|
|
15
|
-
const MIN_GIT_VERSION =
|
|
15
|
+
const MIN_GIT_VERSION = "2.7.1";
|
|
16
16
|
|
|
17
17
|
if (!satisfies(process.version, engines.node)) {
|
|
18
18
|
console.error(
|
|
@@ -23,8 +23,8 @@ See https://github.com/semantic-release/semantic-release/blob/master/docs/suppor
|
|
|
23
23
|
process.exit(1);
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
execa(
|
|
27
|
-
.then(({stdout}) => {
|
|
26
|
+
execa("git", ["--version"])
|
|
27
|
+
.then(({ stdout }) => {
|
|
28
28
|
const gitVersion = findVersions(stdout)[0];
|
|
29
29
|
if (lt(gitVersion, MIN_GIT_VERSION)) {
|
|
30
30
|
console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. Found ${gitVersion}.`);
|
package/cli.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import util from
|
|
2
|
-
import yargs from
|
|
3
|
-
import {hideBin} from
|
|
4
|
-
import hideSensitive from
|
|
1
|
+
import util from "node:util";
|
|
2
|
+
import yargs from "yargs";
|
|
3
|
+
import { hideBin } from "yargs/helpers";
|
|
4
|
+
import hideSensitive from "./lib/hide-sensitive.js";
|
|
5
5
|
|
|
6
6
|
const stringList = {
|
|
7
|
-
type:
|
|
7
|
+
type: "string",
|
|
8
8
|
array: true,
|
|
9
9
|
coerce: (values) =>
|
|
10
|
-
values.length === 1 && values[0].trim() ===
|
|
10
|
+
values.length === 1 && values[0].trim() === "false"
|
|
11
11
|
? []
|
|
12
|
-
: values.reduce((values, value) => values.concat(value.split(
|
|
12
|
+
: values.reduce((values, value) => values.concat(value.split(",").map((value) => value.trim())), []),
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
export default async () => {
|
|
16
16
|
const cli = yargs(hideBin(process.argv))
|
|
17
|
-
.command(
|
|
17
|
+
.command("$0", "Run automated package publishing", (yargs) => {
|
|
18
18
|
yargs.demandCommand(0, 0).usage(`Run automated package publishing
|
|
19
19
|
|
|
20
20
|
Usage:
|
|
21
21
|
semantic-release [options] [plugins]`);
|
|
22
22
|
})
|
|
23
|
-
.option(
|
|
24
|
-
.option(
|
|
25
|
-
.option(
|
|
26
|
-
.option(
|
|
27
|
-
.option(
|
|
28
|
-
.option(
|
|
29
|
-
.option(
|
|
30
|
-
.option(
|
|
31
|
-
.option(
|
|
32
|
-
.option(
|
|
33
|
-
.option(
|
|
34
|
-
.option(
|
|
35
|
-
.option(
|
|
36
|
-
.option(
|
|
37
|
-
.option(
|
|
38
|
-
.option(
|
|
39
|
-
.option(
|
|
23
|
+
.option("b", { alias: "branches", describe: "Git branches to release from", ...stringList, group: "Options" })
|
|
24
|
+
.option("r", { alias: "repository-url", describe: "Git repository URL", type: "string", group: "Options" })
|
|
25
|
+
.option("t", { alias: "tag-format", describe: "Git tag format", type: "string", group: "Options" })
|
|
26
|
+
.option("p", { alias: "plugins", describe: "Plugins", ...stringList, group: "Options" })
|
|
27
|
+
.option("e", { alias: "extends", describe: "Shareable configurations", ...stringList, group: "Options" })
|
|
28
|
+
.option("ci", { describe: "Toggle CI verifications", type: "boolean", group: "Options" })
|
|
29
|
+
.option("verify-conditions", { ...stringList, group: "Plugins" })
|
|
30
|
+
.option("analyze-commits", { type: "string", group: "Plugins" })
|
|
31
|
+
.option("verify-release", { ...stringList, group: "Plugins" })
|
|
32
|
+
.option("generate-notes", { ...stringList, group: "Plugins" })
|
|
33
|
+
.option("prepare", { ...stringList, group: "Plugins" })
|
|
34
|
+
.option("publish", { ...stringList, group: "Plugins" })
|
|
35
|
+
.option("success", { ...stringList, group: "Plugins" })
|
|
36
|
+
.option("fail", { ...stringList, group: "Plugins" })
|
|
37
|
+
.option("debug", { describe: "Output debugging information", type: "boolean", group: "Options" })
|
|
38
|
+
.option("d", { alias: "dry-run", describe: "Skip publishing", type: "boolean", group: "Options" })
|
|
39
|
+
.option("h", { alias: "help", group: "Options" })
|
|
40
40
|
.strict(false)
|
|
41
41
|
.exitProcess(false);
|
|
42
42
|
|
|
43
43
|
try {
|
|
44
|
-
const {help, version, ...options} = cli.parse(process.argv.slice(2));
|
|
44
|
+
const { help, version, ...options } = cli.parse(process.argv.slice(2));
|
|
45
45
|
|
|
46
46
|
if (Boolean(help) || Boolean(version)) {
|
|
47
47
|
return 0;
|
|
@@ -49,16 +49,16 @@ Usage:
|
|
|
49
49
|
|
|
50
50
|
if (options.debug) {
|
|
51
51
|
// Debug must be enabled before other requires in order to work
|
|
52
|
-
(await import(
|
|
52
|
+
(await import("debug")).default.enable("semantic-release:*");
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
await (await import(
|
|
55
|
+
await (await import("./index.js")).default(options);
|
|
56
56
|
return 0;
|
|
57
57
|
} catch (error) {
|
|
58
|
-
if (error.name !==
|
|
59
|
-
process.stderr.write(hideSensitive(process.env)(util.inspect(error, {colors: true})));
|
|
58
|
+
if (error.name !== "YError") {
|
|
59
|
+
process.stderr.write(hideSensitive(process.env)(util.inspect(error, { colors: true })));
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return 1;
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
};
|
|
@@ -3,43 +3,48 @@
|
|
|
3
3
|
## Usage
|
|
4
4
|
|
|
5
5
|
```js
|
|
6
|
-
const semanticRelease = require(
|
|
7
|
-
const {WritableStreamBuffer} = require(
|
|
6
|
+
const semanticRelease = require("semantic-release");
|
|
7
|
+
const { WritableStreamBuffer } = require("stream-buffers");
|
|
8
8
|
|
|
9
9
|
const stdoutBuffer = WritableStreamBuffer();
|
|
10
10
|
const stderrBuffer = WritableStreamBuffer();
|
|
11
11
|
|
|
12
12
|
try {
|
|
13
|
-
const result = await semanticRelease(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
13
|
+
const result = await semanticRelease(
|
|
14
|
+
{
|
|
15
|
+
// Core options
|
|
16
|
+
branches: [
|
|
17
|
+
"+([0-9])?(.{+([0-9]),x}).x",
|
|
18
|
+
"master",
|
|
19
|
+
"next",
|
|
20
|
+
"next-major",
|
|
21
|
+
{ name: "beta", prerelease: true },
|
|
22
|
+
{ name: "alpha", prerelease: true },
|
|
23
|
+
],
|
|
24
|
+
repositoryUrl: "https://github.com/me/my-package.git",
|
|
25
|
+
// Shareable config
|
|
26
|
+
extends: "my-shareable-config",
|
|
27
|
+
// Plugin options
|
|
28
|
+
githubUrl: "https://my-ghe.com",
|
|
29
|
+
githubApiPathPrefix: "/api-prefix",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
// Run semantic-release from `/path/to/git/repo/root` without having to change local process `cwd` with `process.chdir()`
|
|
33
|
+
cwd: "/path/to/git/repo/root",
|
|
34
|
+
// Pass the variable `MY_ENV_VAR` to semantic-release without having to modify the local `process.env`
|
|
35
|
+
env: { ...process.env, MY_ENV_VAR: "MY_ENV_VAR_VALUE" },
|
|
36
|
+
// Store stdout and stderr to use later instead of writing to `process.stdout` and `process.stderr`
|
|
37
|
+
stdout: stdoutBuffer,
|
|
38
|
+
stderr: stderrBuffer,
|
|
39
|
+
}
|
|
40
|
+
);
|
|
38
41
|
|
|
39
42
|
if (result) {
|
|
40
|
-
const {lastRelease, commits, nextRelease, releases} = result;
|
|
43
|
+
const { lastRelease, commits, nextRelease, releases } = result;
|
|
41
44
|
|
|
42
|
-
console.log(
|
|
45
|
+
console.log(
|
|
46
|
+
`Published ${nextRelease.type} release version ${nextRelease.version} containing ${commits.length} commits.`
|
|
47
|
+
);
|
|
43
48
|
|
|
44
49
|
if (lastRelease.version) {
|
|
45
50
|
console.log(`The last release was "${lastRelease.version}".`);
|
|
@@ -49,14 +54,14 @@ try {
|
|
|
49
54
|
console.log(`The release was published with plugin "${release.pluginName}".`);
|
|
50
55
|
}
|
|
51
56
|
} else {
|
|
52
|
-
console.log(
|
|
57
|
+
console.log("No release published.");
|
|
53
58
|
}
|
|
54
59
|
|
|
55
60
|
// Get stdout and stderr content
|
|
56
|
-
const logs = stdoutBuffer.getContentsAsString(
|
|
57
|
-
const errors = stderrBuffer.getContentsAsString(
|
|
61
|
+
const logs = stdoutBuffer.getContentsAsString("utf8");
|
|
62
|
+
const errors = stderrBuffer.getContentsAsString("utf8");
|
|
58
63
|
} catch (err) {
|
|
59
|
-
console.error(
|
|
64
|
+
console.error("The automated release failed with %O", err);
|
|
60
65
|
}
|
|
61
66
|
```
|
|
62
67
|
|
|
@@ -131,7 +136,7 @@ Type: `Object`
|
|
|
131
136
|
Information related to the last release found:
|
|
132
137
|
|
|
133
138
|
| Name | Type | Description |
|
|
134
|
-
|
|
139
|
+
| ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
135
140
|
| version | `String` | The version of the last release. |
|
|
136
141
|
| gitHead | `String` | The sha of the last commit being part of the last release. |
|
|
137
142
|
| gitTag | `String` | The [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) associated with the last release. |
|
|
@@ -140,6 +145,7 @@ Information related to the last release found:
|
|
|
140
145
|
**Notes**: If no previous release is found, `lastRelease` will be an empty `Object`.
|
|
141
146
|
|
|
142
147
|
Example:
|
|
148
|
+
|
|
143
149
|
```js
|
|
144
150
|
{
|
|
145
151
|
gitHead: 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
|
|
@@ -157,7 +163,7 @@ The list of commit included in the new release.<br>
|
|
|
157
163
|
Each commit object has the following properties:
|
|
158
164
|
|
|
159
165
|
| Name | Type | Description |
|
|
160
|
-
|
|
166
|
+
| --------------- | -------- | ----------------------------------------------- |
|
|
161
167
|
| commit | `Object` | The commit abbreviated and full hash. |
|
|
162
168
|
| commit.long | `String` | The commit hash. |
|
|
163
169
|
| commit.short | `String` | The commit abbreviated hash. |
|
|
@@ -179,6 +185,7 @@ Each commit object has the following properties:
|
|
|
179
185
|
| committerDate | `String` | The committer date. |
|
|
180
186
|
|
|
181
187
|
Example:
|
|
188
|
+
|
|
182
189
|
```js
|
|
183
190
|
[
|
|
184
191
|
{
|
|
@@ -216,7 +223,7 @@ Type: `Object`
|
|
|
216
223
|
Information related to the newly published release:
|
|
217
224
|
|
|
218
225
|
| Name | Type | Description |
|
|
219
|
-
|
|
226
|
+
| ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
220
227
|
| type | `String` | The [semver](https://semver.org) type of the release (`patch`, `minor` or `major`). |
|
|
221
228
|
| version | `String` | The version of the new release. |
|
|
222
229
|
| gitHead | `String` | The sha of the last commit being part of the new release. |
|
|
@@ -225,6 +232,7 @@ Information related to the newly published release:
|
|
|
225
232
|
| channel | `String` | The distribution channel on which the next release will be made available (`undefined` for the default distribution channel). |
|
|
226
233
|
|
|
227
234
|
Example:
|
|
235
|
+
|
|
228
236
|
```js
|
|
229
237
|
{
|
|
230
238
|
type: 'minor',
|
|
@@ -244,7 +252,7 @@ The list of releases published or made available to a distribution channel.<br>
|
|
|
244
252
|
Each release object has the following properties:
|
|
245
253
|
|
|
246
254
|
| Name | Type | Description |
|
|
247
|
-
|
|
255
|
+
| ---------- | -------- | -------------------------------------------------------------------------------------------------------------- |
|
|
248
256
|
| name | `String` | **Optional.** The release name, only if set by the corresponding `publish` plugin. |
|
|
249
257
|
| url | `String` | **Optional.** The release URL, only if set by the corresponding `publish` plugin. |
|
|
250
258
|
| type | `String` | The [semver](https://semver.org) type of the release (`patch`, `minor` or `major`). |
|
|
@@ -256,6 +264,7 @@ Each release object has the following properties:
|
|
|
256
264
|
| channel | `String` | The distribution channel on which the release is available (`undefined` for the default distribution channel). |
|
|
257
265
|
|
|
258
266
|
Example:
|
|
267
|
+
|
|
259
268
|
```js
|
|
260
269
|
[
|
|
261
270
|
{
|
|
@@ -34,7 +34,7 @@ We recommend you setup a linting system to ensure good javascript practices are
|
|
|
34
34
|
In your `index.js` file, you can start by writing the following code
|
|
35
35
|
|
|
36
36
|
```javascript
|
|
37
|
-
const verify = require(
|
|
37
|
+
const verify = require("./src/verify");
|
|
38
38
|
|
|
39
39
|
let verified;
|
|
40
40
|
|
|
@@ -54,7 +54,7 @@ module.exports = { verifyConditions };
|
|
|
54
54
|
Then, in your `src` folder, create a file called `verify.js` and add the following
|
|
55
55
|
|
|
56
56
|
```javascript
|
|
57
|
-
const AggregateError = require(
|
|
57
|
+
const AggregateError = require("aggregate-error");
|
|
58
58
|
|
|
59
59
|
/**
|
|
60
60
|
* A method to verify that the user has given us a slack webhook url to post to
|
|
@@ -80,10 +80,10 @@ Let's say we want to verify that an `option` is passed. An `option` is a configu
|
|
|
80
80
|
|
|
81
81
|
```js
|
|
82
82
|
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
prepare: {
|
|
84
|
+
path: "@semantic-release/my-special-plugin";
|
|
85
|
+
message: "My cool release message";
|
|
86
|
+
}
|
|
87
87
|
}
|
|
88
88
|
```
|
|
89
89
|
|
|
@@ -93,7 +93,7 @@ This `message` option will be passed to the `pluginConfig` object mentioned earl
|
|
|
93
93
|
const { message } = pluginConfig;
|
|
94
94
|
|
|
95
95
|
if (message.length) {
|
|
96
|
-
|
|
96
|
+
//...
|
|
97
97
|
}
|
|
98
98
|
```
|
|
99
99
|
|
|
@@ -101,103 +101,104 @@ if (message.length) {
|
|
|
101
101
|
|
|
102
102
|
### Common context keys
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
- `stdout`
|
|
105
|
+
- `stderr`
|
|
106
|
+
- `logger`
|
|
107
107
|
|
|
108
108
|
### Context object keys by lifecycle
|
|
109
109
|
|
|
110
110
|
#### verifyConditions
|
|
111
111
|
|
|
112
112
|
Initially the context object contains the following keys (`verifyConditions` lifecycle):
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
113
|
+
|
|
114
|
+
- `cwd`
|
|
115
|
+
- Current working directory
|
|
116
|
+
- `env`
|
|
117
|
+
- Environment variables
|
|
118
|
+
- `envCi`
|
|
119
|
+
- Information about CI environment
|
|
120
|
+
- Contains (at least) the following keys:
|
|
121
|
+
- `isCi`
|
|
122
|
+
- Boolean, true if the environment is a CI environment
|
|
123
|
+
- `commit`
|
|
124
|
+
- Commit hash
|
|
125
|
+
- `branch`
|
|
126
|
+
- Current branch
|
|
127
|
+
- `options`
|
|
128
|
+
- Options passed to `semantic-release` via CLI, configuration files etc.
|
|
129
|
+
- `branch`
|
|
130
|
+
- Information on the current branch
|
|
131
|
+
- Object keys:
|
|
132
|
+
- `channel`
|
|
133
|
+
- `tags`
|
|
134
|
+
- `type`
|
|
135
|
+
- `name`
|
|
136
|
+
- `range`
|
|
137
|
+
- `accept`
|
|
138
|
+
- `main`
|
|
139
|
+
- `branches`
|
|
140
|
+
- Information on branches
|
|
141
|
+
- List of branch objects (see above)
|
|
141
142
|
|
|
142
143
|
#### analyzeCommits
|
|
143
144
|
|
|
144
145
|
Compared to the verifyConditions, `analyzeCommits` lifecycle context has keys
|
|
145
146
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
147
|
+
- `commits` (List)
|
|
148
|
+
- List of commits taken into account when determining the new version.
|
|
149
|
+
- Keys:
|
|
150
|
+
- `commit` (Object)
|
|
151
|
+
- Keys:
|
|
152
|
+
- `long` (String, Commit hash)
|
|
153
|
+
- `short` (String, Commit hash)
|
|
154
|
+
- `tree` (Object)
|
|
155
|
+
- Keys:
|
|
156
|
+
- `long` (String, Commit hash)
|
|
157
|
+
- `short` (String, Commit hash)
|
|
158
|
+
- `author` (Object)
|
|
159
|
+
- Keys:
|
|
160
|
+
- `name` (String)
|
|
161
|
+
- `email` (String)
|
|
162
|
+
- `date` (String, ISO 8601 timestamp)
|
|
163
|
+
- `committer` (Object)
|
|
164
|
+
- Keys:
|
|
165
|
+
- `name` (String)
|
|
166
|
+
- `email` (String)
|
|
167
|
+
- `date` (String, ISO 8601 timestamp)
|
|
168
|
+
- `subject` (String, Commit message subject)
|
|
169
|
+
- `body` (String, Commit message body)
|
|
170
|
+
- `hash` (String, Commit hash)
|
|
171
|
+
- `committerDate` (String, ISO 8601 timestamp)
|
|
172
|
+
- `message` (String)
|
|
173
|
+
- `gitTags` (String, List of git tags)
|
|
174
|
+
- `releases` (List)
|
|
175
|
+
- `lastRelease` (Object)
|
|
176
|
+
- Keys
|
|
177
|
+
- `version` (String)
|
|
178
|
+
- `gitTag` (String)
|
|
179
|
+
- `channels` (List)
|
|
180
|
+
- `gitHead` (String, Commit hash)
|
|
181
|
+
- `name` (String)
|
|
181
182
|
|
|
182
183
|
#### verifyRelease
|
|
183
184
|
|
|
184
185
|
Additional keys:
|
|
185
186
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
187
|
+
- `nextRelease` (Object)
|
|
188
|
+
- `type` (String)
|
|
189
|
+
- `channel` (String)
|
|
190
|
+
- `gitHead` (String, Git hash)
|
|
191
|
+
- `version` (String, version without `v`)
|
|
192
|
+
- `gitTag` (String, version with `v`)
|
|
193
|
+
- `name` (String)
|
|
194
|
+
|
|
194
195
|
#### generateNotes
|
|
195
196
|
|
|
196
197
|
No new content in the context.
|
|
197
198
|
|
|
198
199
|
#### addChannel
|
|
199
200
|
|
|
200
|
-
|
|
201
|
+
_This is run only if there are releases that have been merged from a higher branch but not added on the channel of the current branch._
|
|
201
202
|
|
|
202
203
|
Context content is similar to lifecycle `verifyRelease`.
|
|
203
204
|
|
|
@@ -215,8 +216,8 @@ Lifecycles `success` and `fail` are mutually exclusive, only one of them will be
|
|
|
215
216
|
|
|
216
217
|
Additional keys:
|
|
217
218
|
|
|
218
|
-
|
|
219
|
-
|
|
219
|
+
- `releases`
|
|
220
|
+
- Populated by `publish` lifecycle
|
|
220
221
|
|
|
221
222
|
#### fail
|
|
222
223
|
|
|
@@ -224,7 +225,7 @@ Lifecycles `success` and `fail` are mutually exclusive, only one of them will be
|
|
|
224
225
|
|
|
225
226
|
Additional keys:
|
|
226
227
|
|
|
227
|
-
|
|
228
|
+
- `errors`
|
|
228
229
|
|
|
229
230
|
### Supporting Environment Variables
|
|
230
231
|
|
|
@@ -237,13 +238,15 @@ if (env.GITHUB_TOKEN) {
|
|
|
237
238
|
//...
|
|
238
239
|
}
|
|
239
240
|
```
|
|
241
|
+
|
|
240
242
|
## Logger
|
|
243
|
+
|
|
241
244
|
Use `context.logger` to provide debug logging in the plugin.
|
|
242
245
|
|
|
243
246
|
```js
|
|
244
247
|
const { logger } = context;
|
|
245
248
|
|
|
246
|
-
logger.log('Some message from plugin.').
|
|
249
|
+
logger.log('Some message from plugin.').
|
|
247
250
|
```
|
|
248
251
|
|
|
249
252
|
The above usage yields the following where `PLUGIN_PACKAGE_NAME` is automatically inferred.
|
|
@@ -269,12 +272,13 @@ Knowledge that might be useful for plugin developers.
|
|
|
269
272
|
While it may be trivial that multiple analyzeCommits (or any lifecycle plugins) can be defined, it is not that self-evident that the plugins executed AFTER the first one (for example, the default one: `commit-analyzer`) can change the result. This way it is possible to create more advanced rules or situations, e.g. if none of the commits would result in new release, then a default can be defined.
|
|
270
273
|
|
|
271
274
|
The commit must be a known release type, for example the commit-analyzer has the following default types:
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
275
|
+
|
|
276
|
+
- major
|
|
277
|
+
- premajor
|
|
278
|
+
- minor
|
|
279
|
+
- preminor
|
|
280
|
+
- patch
|
|
281
|
+
- prepatch
|
|
282
|
+
- prerelease
|
|
279
283
|
|
|
280
284
|
If the analyzeCommits-lifecycle plugin does not return anything, then the earlier result is used, but if it returns a supported string value, then that overrides the previous result.
|