semantic-release 25.0.4 → 25.0.6
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 +36 -37
- package/bin/semantic-release.js +1 -1
- package/index.js +265 -37
- package/lib/branches/expand.js +18 -0
- package/lib/branches/get-tags.js +39 -0
- package/lib/branches/index.js +71 -0
- package/lib/branches/normalize.js +104 -0
- package/lib/definitions/branches.js +22 -0
- package/lib/definitions/constants.js +8 -9
- package/lib/definitions/errors.js +303 -0
- package/lib/definitions/plugins.js +108 -0
- package/lib/get-commits.js +31 -0
- package/lib/get-config.js +98 -0
- package/lib/get-error.js +7 -0
- package/lib/get-git-auth-url.js +126 -0
- package/lib/get-last-release.js +48 -0
- package/lib/get-logger.js +19 -0
- package/lib/get-next-version.js +35 -0
- package/lib/get-release-to-add.js +59 -0
- package/lib/git.js +381 -0
- package/lib/hide-sensitive.js +14 -1
- package/lib/plugins/index.js +103 -0
- package/lib/plugins/normalize.js +69 -0
- package/lib/plugins/pipeline.js +59 -0
- package/lib/plugins/utils.js +81 -0
- package/lib/utils.js +101 -0
- package/lib/verify.js +43 -0
- package/package.json +20 -15
- package/docs/README.md +0 -7
- package/docs/developer-guide/README.md +0 -5
- package/docs/developer-guide/js-api.md +0 -294
- package/docs/developer-guide/plugin.md +0 -284
- package/docs/developer-guide/shareable-configuration.md +0 -1
- package/docs/extending/README.md +0 -4
- package/docs/extending/plugins-list.md +0 -233
- package/docs/extending/shareable-configurations-list.md +0 -22
- package/docs/recipes/ci-configurations/README.md +0 -7
- package/docs/recipes/ci-configurations/circleci-workflows.md +0 -49
- package/docs/recipes/ci-configurations/github-actions.md +0 -136
- package/docs/recipes/ci-configurations/gitlab-ci.md +0 -98
- package/docs/recipes/ci-configurations/jenkins-ci.md +0 -61
- package/docs/recipes/ci-configurations/travis.md +0 -97
- package/docs/recipes/git-hosted-services/README.md +0 -3
- package/docs/recipes/git-hosted-services/git-auth-ssh-keys.md +0 -166
- package/docs/recipes/release-workflow/README.md +0 -5
- package/docs/recipes/release-workflow/distribution-channels.md +0 -117
- package/docs/recipes/release-workflow/maintenance-releases.md +0 -157
- package/docs/recipes/release-workflow/pre-releases.md +0 -197
- package/docs/support/FAQ.md +0 -253
- package/docs/support/README.md +0 -7
- package/docs/support/git-version.md +0 -4
- package/docs/support/node-support-policy.md +0 -21
- package/docs/support/node-version.md +0 -38
- package/docs/support/resources.md +0 -22
- package/docs/support/troubleshooting.md +0 -70
- package/docs/usage/README.md +0 -9
- package/docs/usage/ci-configuration.md +0 -50
- package/docs/usage/configuration.md +0 -206
- package/docs/usage/getting-started.md +0 -8
- package/docs/usage/installation.md +0 -51
- package/docs/usage/plugins.md +0 -105
- package/docs/usage/shareable-configurations.md +0 -7
- package/docs/usage/workflow-configuration.md +0 -199
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { dirname } from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { castArray, isArray, isFunction, isNil, isPlainObject, isString } from "lodash-es";
|
|
4
|
+
import resolveFrom from "resolve-from";
|
|
5
|
+
|
|
6
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
7
|
+
|
|
8
|
+
const validateSteps = (conf) => {
|
|
9
|
+
return conf.every((conf) => {
|
|
10
|
+
if (
|
|
11
|
+
isArray(conf) &&
|
|
12
|
+
(conf.length === 1 || conf.length === 2) &&
|
|
13
|
+
(isString(conf[0]) || isFunction(conf[0])) &&
|
|
14
|
+
(isNil(conf[1]) || isPlainObject(conf[1]))
|
|
15
|
+
) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
conf = castArray(conf);
|
|
20
|
+
|
|
21
|
+
if (conf.length !== 1) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const [name, config] = parseConfig(conf[0]);
|
|
26
|
+
return (isString(name) || isFunction(name)) && isPlainObject(config);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export function validatePlugin(conf) {
|
|
31
|
+
return (
|
|
32
|
+
isString(conf) ||
|
|
33
|
+
(isArray(conf) &&
|
|
34
|
+
(conf.length === 1 || conf.length === 2) &&
|
|
35
|
+
(isString(conf[0]) || isPlainObject(conf[0])) &&
|
|
36
|
+
(isNil(conf[1]) || isPlainObject(conf[1]))) ||
|
|
37
|
+
(isPlainObject(conf) && (isNil(conf.path) || isString(conf.path) || isPlainObject(conf.path)))
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function validateStep({ required }, conf) {
|
|
42
|
+
conf = castArray(conf).filter(Boolean);
|
|
43
|
+
if (required) {
|
|
44
|
+
return conf.length >= 1 && validateSteps(conf);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return conf.length === 0 || validateSteps(conf);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export async function loadPlugin({ cwd }, name, pluginsPath) {
|
|
51
|
+
const basePath = pluginsPath[name]
|
|
52
|
+
? dirname(resolveFrom.silent(__dirname, pluginsPath[name]) || resolveFrom(cwd, pluginsPath[name]))
|
|
53
|
+
: __dirname;
|
|
54
|
+
|
|
55
|
+
if (isFunction(name)) {
|
|
56
|
+
return name;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const file = resolveFrom.silent(basePath, name) || resolveFrom(cwd, name);
|
|
60
|
+
const { default: cjsExport, ...esmNamedExports } = await import(`file://${file}`);
|
|
61
|
+
|
|
62
|
+
if (cjsExport) {
|
|
63
|
+
return cjsExport;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return esmNamedExports;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function parseConfig(plugin) {
|
|
70
|
+
let path;
|
|
71
|
+
let config;
|
|
72
|
+
if (isArray(plugin)) {
|
|
73
|
+
[path, config] = plugin;
|
|
74
|
+
} else if (isPlainObject(plugin) && !isNil(plugin.path)) {
|
|
75
|
+
({ path, ...config } = plugin);
|
|
76
|
+
} else {
|
|
77
|
+
path = plugin;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return [path, config || {}];
|
|
81
|
+
}
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { template, union } from "lodash-es";
|
|
2
|
+
import semver from "semver";
|
|
3
|
+
import hideSensitive from "./hide-sensitive.js";
|
|
4
|
+
|
|
5
|
+
export function extractErrors(err) {
|
|
6
|
+
return err && err.errors ? [...err.errors] : [err];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function hideSensitiveValues(env, objs) {
|
|
10
|
+
const hideFunction = hideSensitive(env);
|
|
11
|
+
return objs.map((object) => {
|
|
12
|
+
Object.getOwnPropertyNames(object).forEach((prop) => {
|
|
13
|
+
if (object[prop]) {
|
|
14
|
+
object[prop] = hideFunction(object[prop]);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return object;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function tagsToVersions(tags) {
|
|
22
|
+
return tags.map(({ version }) => version);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function isMajorRange(range) {
|
|
26
|
+
return /^\d+\.x(?:\.x)?$/i.test(range);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function isMaintenanceRange(range) {
|
|
30
|
+
return /^\d+(?:\.(?:\d+|x))?\.x$/i.test(range);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function getUpperBound(range) {
|
|
34
|
+
const result = semver.valid(range)
|
|
35
|
+
? range
|
|
36
|
+
: ((semver.validRange(range) || "").match(/<(?<upperBound>\d+\.\d+\.\d+(-\d+)?)$/) || [])[1];
|
|
37
|
+
|
|
38
|
+
return result
|
|
39
|
+
? // https://github.com/npm/node-semver/issues/322
|
|
40
|
+
result.replace(/-\d+$/, "")
|
|
41
|
+
: result;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function getLowerBound(range) {
|
|
45
|
+
return ((semver.validRange(range) || "").match(/(?<lowerBound>\d+\.\d+\.\d+)/) || [])[1];
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function highest(version1, version2) {
|
|
49
|
+
return version1 && version2 ? (semver.gt(version1, version2) ? version1 : version2) : version1 || version2;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function lowest(version1, version2) {
|
|
53
|
+
return version1 && version2 ? (semver.lt(version1, version2) ? version1 : version2) : version1 || version2;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getLatestVersion(versions, { withPrerelease } = {}) {
|
|
57
|
+
return versions.filter((version) => withPrerelease || !semver.prerelease(version)).sort(semver.rcompare)[0];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function getEarliestVersion(versions, { withPrerelease } = {}) {
|
|
61
|
+
return versions.filter((version) => withPrerelease || !semver.prerelease(version)).sort(semver.compare)[0];
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function getFirstVersion(versions, lowerBranches) {
|
|
65
|
+
const lowerVersion = union(...lowerBranches.map(({ tags }) => tagsToVersions(tags))).sort(semver.rcompare);
|
|
66
|
+
if (lowerVersion[0]) {
|
|
67
|
+
return versions.sort(semver.compare).find((version) => semver.gt(version, lowerVersion[0]));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return getEarliestVersion(versions);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function getRange(min, max) {
|
|
74
|
+
return `>=${min}${max ? ` <${max}` : ""}`;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function makeTag(tagFormat, version) {
|
|
78
|
+
return template(tagFormat)({ version });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export function isSameChannel(channel, otherChannel) {
|
|
82
|
+
return channel === otherChannel || (!channel && !otherChannel);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function getVersionDiff(version1, version2) {
|
|
86
|
+
if (semver.gte(version1, version2)) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return semver.diff(version1, version2);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function extractGitLogTags(tagsString) {
|
|
94
|
+
const regex = /tag: ([^,)]+)/g;
|
|
95
|
+
let match;
|
|
96
|
+
const tags = [];
|
|
97
|
+
while ((match = regex.exec(tagsString)) !== null) {
|
|
98
|
+
tags.push(match[1]);
|
|
99
|
+
}
|
|
100
|
+
return tags;
|
|
101
|
+
}
|
package/lib/verify.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { isPlainObject, isString, template } from "lodash-es";
|
|
2
|
+
import AggregateError from "aggregate-error";
|
|
3
|
+
import { isGitRepo, verifyTagName } from "./git.js";
|
|
4
|
+
import getError from "./get-error.js";
|
|
5
|
+
|
|
6
|
+
export default async (context) => {
|
|
7
|
+
const {
|
|
8
|
+
cwd,
|
|
9
|
+
env,
|
|
10
|
+
options: { repositoryUrl, tagFormat, branches },
|
|
11
|
+
} = context;
|
|
12
|
+
const errors = [];
|
|
13
|
+
|
|
14
|
+
if (!(await isGitRepo({ cwd, env }))) {
|
|
15
|
+
errors.push(getError("ENOGITREPO", { cwd }));
|
|
16
|
+
} else if (!repositoryUrl) {
|
|
17
|
+
errors.push(getError("ENOREPOURL"));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Verify that compiling the `tagFormat` produce a valid Git tag
|
|
21
|
+
if (!(await verifyTagName(template(tagFormat)({ version: "0.0.0" })))) {
|
|
22
|
+
errors.push(getError("EINVALIDTAGFORMAT", context));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Verify the `tagFormat` contains the variable `version` by compiling the `tagFormat` template
|
|
26
|
+
// with a space as the `version` value and verify the result contains the space.
|
|
27
|
+
// The space is used as it's an invalid tag character, so it's guaranteed to no be present in the `tagFormat`.
|
|
28
|
+
if ((template(tagFormat)({ version: " " }).match(/ /g) || []).length !== 1) {
|
|
29
|
+
errors.push(getError("ETAGNOVERSION", context));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
branches.forEach((branch) => {
|
|
33
|
+
if (
|
|
34
|
+
!((isString(branch) && branch.trim()) || (isPlainObject(branch) && isString(branch.name) && branch.name.trim()))
|
|
35
|
+
) {
|
|
36
|
+
errors.push(getError("EINVALIDBRANCH", { branch }));
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
if (errors.length > 0) {
|
|
41
|
+
throw new AggregateError(errors);
|
|
42
|
+
}
|
|
43
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semantic-release",
|
|
3
3
|
"description": "Automated semver compliant package publishing",
|
|
4
|
-
"version": "25.0.
|
|
4
|
+
"version": "25.0.6",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "Stephan Bönnemann <stephan@boennemann.me> (http://boennemann.me)",
|
|
7
7
|
"ava": {
|
|
@@ -57,28 +57,28 @@
|
|
|
57
57
|
"yargs": "^18.0.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@types/node": "24.
|
|
60
|
+
"@types/node": "24.13.2",
|
|
61
61
|
"@types/signale": "1.4.7",
|
|
62
62
|
"ava": "8.0.1",
|
|
63
63
|
"c8": "11.0.0",
|
|
64
64
|
"clear-module": "4.1.3",
|
|
65
65
|
"cz-conventional-changelog": "3.3.0",
|
|
66
|
-
"dockerode": "5.0.0",
|
|
67
66
|
"file-url": "4.0.0",
|
|
68
|
-
"fs-extra": "11.3.
|
|
69
|
-
"got": "15.0
|
|
70
|
-
"js-yaml": "4.
|
|
67
|
+
"fs-extra": "11.3.6",
|
|
68
|
+
"got": "15.1.0",
|
|
69
|
+
"js-yaml": "4.3.0",
|
|
71
70
|
"lockfile-lint": "5.0.0",
|
|
72
|
-
"ls-engines": "0.10.
|
|
73
|
-
"mockserver-client": "
|
|
74
|
-
"nock": "14.0.
|
|
75
|
-
"npm-run-all2": "9.0.
|
|
71
|
+
"ls-engines": "0.10.1",
|
|
72
|
+
"mockserver-client": "7.4.0",
|
|
73
|
+
"nock": "14.0.16",
|
|
74
|
+
"npm-run-all2": "9.0.2",
|
|
76
75
|
"p-retry": "8.0.0",
|
|
77
|
-
"prettier": "3.8.
|
|
76
|
+
"prettier": "3.8.5",
|
|
78
77
|
"publint": "0.3.21",
|
|
79
78
|
"sinon": "22.0.0",
|
|
80
79
|
"stream-buffers": "3.0.3",
|
|
81
80
|
"tempy": "3.2.0",
|
|
81
|
+
"testcontainers": "12.0.4",
|
|
82
82
|
"testdouble": "3.20.2"
|
|
83
83
|
},
|
|
84
84
|
"engines": {
|
|
@@ -146,8 +146,8 @@
|
|
|
146
146
|
}
|
|
147
147
|
},
|
|
148
148
|
"scripts": {
|
|
149
|
-
"lint:prettier": "prettier --check \"*.{js,json,md}\" \".github/**/*.{md,yml}\" \"
|
|
150
|
-
"lint:prettier:fix": "prettier --write \"*.{js,json,md}\" \".github/**/*.{md,yml}\" \"
|
|
149
|
+
"lint:prettier": "prettier --check \"*.{js,json,md}\" \".github/**/*.{md,yml}\" \"{bin,lib,test}/**/*.js\"",
|
|
150
|
+
"lint:prettier:fix": "prettier --write \"*.{js,json,md}\" \".github/**/*.{md,yml}\" \"{bin,lib,test}/**/*.js\"",
|
|
151
151
|
"lint:lockfile": "lockfile-lint",
|
|
152
152
|
"lint:engines": "ls-engines",
|
|
153
153
|
"lint:publish": "publint --strict",
|
|
@@ -160,7 +160,12 @@
|
|
|
160
160
|
"renovate": {
|
|
161
161
|
"extends": [
|
|
162
162
|
"github>semantic-release/.github:renovate-config"
|
|
163
|
-
]
|
|
163
|
+
],
|
|
164
|
+
"docker-compose": {
|
|
165
|
+
"managerFilePatterns": [
|
|
166
|
+
"/(^|/)e2e\\.compose\\.ya?ml$/"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
164
169
|
},
|
|
165
|
-
"packageManager": "npm@11.
|
|
170
|
+
"packageManager": "npm@11.18.0+sha512.4faecce0be70366d1c67b1012c4adc1246354a6cc45bf589f92003073b05518d547403df1475c542d67a4845e22b4fafcd7cac0af02c7a96cc6814f09eb003fb"
|
|
166
171
|
}
|
package/docs/README.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
# semantic-release documentation
|
|
2
|
-
|
|
3
|
-
- [Usage](usage/README.md) - **semantic-release** installation and configuration
|
|
4
|
-
- [Extending](extending/README.md) - Extending **semantic-release** with plugins and shareable configurations
|
|
5
|
-
- [Recipes](recipes/release-workflow/README.md) - Community written recipes for common **semantic-release** use-cases
|
|
6
|
-
- [Developer Guide](developer-guide/README.md) - The essentials of writing a **semantic-release** plugin or shareable configurations
|
|
7
|
-
- [Support](support/README.md) - FAQ and troubleshooting
|
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
# JavaScript API
|
|
2
|
-
|
|
3
|
-
## Usage
|
|
4
|
-
|
|
5
|
-
```js
|
|
6
|
-
const semanticRelease = require("semantic-release");
|
|
7
|
-
const { WritableStreamBuffer } = require("stream-buffers");
|
|
8
|
-
|
|
9
|
-
const stdoutBuffer = new WritableStreamBuffer();
|
|
10
|
-
const stderrBuffer = new WritableStreamBuffer();
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const result = await semanticRelease(
|
|
14
|
-
{
|
|
15
|
-
// Core options
|
|
16
|
-
branches: [
|
|
17
|
-
"+([0-9])?(.{+([0-9]),x}).x",
|
|
18
|
-
"master",
|
|
19
|
-
"main",
|
|
20
|
-
"next",
|
|
21
|
-
"next-major",
|
|
22
|
-
{ name: "beta", prerelease: true },
|
|
23
|
-
{ name: "alpha", prerelease: true },
|
|
24
|
-
],
|
|
25
|
-
repositoryUrl: "https://github.com/me/my-package.git",
|
|
26
|
-
// Shareable config
|
|
27
|
-
extends: "my-shareable-config",
|
|
28
|
-
// Plugin options
|
|
29
|
-
githubUrl: "https://my-ghe.com",
|
|
30
|
-
githubApiPathPrefix: "/api-prefix",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
// Run semantic-release from `/path/to/git/repo/root` without having to change local process `cwd` with `process.chdir()`
|
|
34
|
-
cwd: "/path/to/git/repo/root",
|
|
35
|
-
// Pass the variable `MY_ENV_VAR` to semantic-release without having to modify the local `process.env`
|
|
36
|
-
env: { ...process.env, MY_ENV_VAR: "MY_ENV_VAR_VALUE" },
|
|
37
|
-
// Store stdout and stderr to use later instead of writing to `process.stdout` and `process.stderr`
|
|
38
|
-
stdout: stdoutBuffer,
|
|
39
|
-
stderr: stderrBuffer,
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
if (result) {
|
|
44
|
-
const { lastRelease, commits, nextRelease, releases } = result;
|
|
45
|
-
|
|
46
|
-
console.log(
|
|
47
|
-
`Published ${nextRelease.type} release version ${nextRelease.version} containing ${commits.length} commits.`
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
if (lastRelease.version) {
|
|
51
|
-
console.log(`The last release was "${lastRelease.version}".`);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
for (const release of releases) {
|
|
55
|
-
console.log(`The release was published with plugin "${release.pluginName}".`);
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
console.log("No release published.");
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Get stdout and stderr content
|
|
62
|
-
const logs = stdoutBuffer.getContentsAsString("utf8");
|
|
63
|
-
const errors = stderrBuffer.getContentsAsString("utf8");
|
|
64
|
-
} catch (err) {
|
|
65
|
-
console.error("The automated release failed with %O", err);
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## API
|
|
70
|
-
|
|
71
|
-
### semanticRelease([options], [config]) => Promise<Result>
|
|
72
|
-
|
|
73
|
-
Run **semantic-release** and returns a `Promise` that resolves to a [Result](#result) object.
|
|
74
|
-
|
|
75
|
-
#### options
|
|
76
|
-
|
|
77
|
-
Type: `Object`
|
|
78
|
-
|
|
79
|
-
**semantic-release** options.
|
|
80
|
-
|
|
81
|
-
Can be used to set any [core option](../usage/configuration.md#configuration) or [plugin options](../usage/plugins.md#configuration).
|
|
82
|
-
|
|
83
|
-
Each option, will take precedence over options configured in the [configuration file](../usage/configuration.md#configuration) and [shareable configurations](../usage/configuration.md#extends).
|
|
84
|
-
|
|
85
|
-
#### config
|
|
86
|
-
|
|
87
|
-
Type: `Object`
|
|
88
|
-
|
|
89
|
-
**semantic-release** configuration specific for API usage.
|
|
90
|
-
|
|
91
|
-
##### cwd
|
|
92
|
-
|
|
93
|
-
Type: `String`<br>
|
|
94
|
-
Default: `process.cwd()`
|
|
95
|
-
|
|
96
|
-
The current working directory to use. It should be configured to the root of the Git repository to release from.
|
|
97
|
-
|
|
98
|
-
It allows to run **semantic-release** from a specific path without having to change the local process `cwd` with `process.chdir()`.
|
|
99
|
-
|
|
100
|
-
##### env
|
|
101
|
-
|
|
102
|
-
Type: `Object`<br>
|
|
103
|
-
Default: `process.env`
|
|
104
|
-
|
|
105
|
-
The environment variables to use.
|
|
106
|
-
|
|
107
|
-
It allows to run **semantic-release** with specific environment variables without having to modify the local `process.env`.
|
|
108
|
-
|
|
109
|
-
##### stdout
|
|
110
|
-
|
|
111
|
-
Type: [`stream.Writable`](https://nodejs.org/api/stream.html#stream_writable_streams)<br>
|
|
112
|
-
Default: `process.stdout`
|
|
113
|
-
|
|
114
|
-
The [writable stream](https://nodejs.org/api/stream.html#stream_writable_streams) used to log information.
|
|
115
|
-
|
|
116
|
-
It allows to configure **semantic-release** to write logs to a specific stream rather than the local `process.stdout`.
|
|
117
|
-
|
|
118
|
-
##### stderr
|
|
119
|
-
|
|
120
|
-
Type: [`stream.Writable`](https://nodejs.org/api/stream.html#stream_writable_streams)<br>
|
|
121
|
-
Default: `process.stderr`
|
|
122
|
-
|
|
123
|
-
The [writable stream](https://nodejs.org/api/stream.html#stream_writable_streams) used to log errors.
|
|
124
|
-
|
|
125
|
-
It allows to configure **semantic-release** to write errors to a specific stream rather than the local `process.stderr`.
|
|
126
|
-
|
|
127
|
-
### Result
|
|
128
|
-
|
|
129
|
-
Type: `Object` `Boolean`<br>
|
|
130
|
-
|
|
131
|
-
An object with [`lastRelease`](#lastrelease), [`nextRelease`](#nextrelease), [`commits`](#commits) and [`releases`](#releases) if a release is published or `false` if no release was published.
|
|
132
|
-
|
|
133
|
-
#### lastRelease
|
|
134
|
-
|
|
135
|
-
Type: `Object`
|
|
136
|
-
|
|
137
|
-
Information related to the last release found:
|
|
138
|
-
|
|
139
|
-
| Name | Type | Description |
|
|
140
|
-
| ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
141
|
-
| version | `String` | The version of the last release. |
|
|
142
|
-
| gitHead | `String` | The sha of the last commit being part of the last release. |
|
|
143
|
-
| gitTag | `String` | The [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) associated with the last release. |
|
|
144
|
-
| channel | `String` | The distribution channel on which the last release was initially made available (`undefined` for the default distribution channel). |
|
|
145
|
-
|
|
146
|
-
**Note**: If no previous release is found, `lastRelease` will be an empty `Object`.
|
|
147
|
-
|
|
148
|
-
Example:
|
|
149
|
-
|
|
150
|
-
```js
|
|
151
|
-
{
|
|
152
|
-
gitHead: 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
|
|
153
|
-
version: '1.0.0',
|
|
154
|
-
gitTag: 'v1.0.0',
|
|
155
|
-
channel: 'next'
|
|
156
|
-
}
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
#### commits
|
|
160
|
-
|
|
161
|
-
Type: `Array<Object>`
|
|
162
|
-
|
|
163
|
-
The list of commit(s) included in the new release.<br>
|
|
164
|
-
Each commit object has the following properties:
|
|
165
|
-
|
|
166
|
-
| Name | Type | Description |
|
|
167
|
-
| --------------- | -------- | ----------------------------------------------- |
|
|
168
|
-
| commit | `Object` | The commit abbreviated and full hash. |
|
|
169
|
-
| commit.long | `String` | The commit hash. |
|
|
170
|
-
| commit.short | `String` | The commit abbreviated hash. |
|
|
171
|
-
| tree | `Object` | The commit abbreviated and full tree hash. |
|
|
172
|
-
| tree.long | `String` | The commit tree hash. |
|
|
173
|
-
| tree.short | `String` | The commit abbreviated tree hash. |
|
|
174
|
-
| author | `Object` | The commit author information. |
|
|
175
|
-
| author.name | `String` | The commit author name. |
|
|
176
|
-
| author.email | `String` | The commit author email. |
|
|
177
|
-
| author.short | `String` | The commit author date. |
|
|
178
|
-
| committer | `Object` | The committer information. |
|
|
179
|
-
| committer.name | `String` | The committer name. |
|
|
180
|
-
| committer.email | `String` | The committer email. |
|
|
181
|
-
| committer.short | `String` | The committer date. |
|
|
182
|
-
| subject | `String` | The commit subject. |
|
|
183
|
-
| body | `String` | The commit body. |
|
|
184
|
-
| message | `String` | The commit full message (`subject` and `body`). |
|
|
185
|
-
| hash | `String` | The commit hash. |
|
|
186
|
-
| committerDate | `String` | The committer date. |
|
|
187
|
-
|
|
188
|
-
Example:
|
|
189
|
-
|
|
190
|
-
```js
|
|
191
|
-
[
|
|
192
|
-
{
|
|
193
|
-
commit: {
|
|
194
|
-
long: '68eb2c4d778050b0701136ca129f837d7ed494d2',
|
|
195
|
-
short: '68eb2c4'
|
|
196
|
-
},
|
|
197
|
-
tree: {
|
|
198
|
-
long: '7ab515d12bd2cf431745511ac4ee13fed15ab578',
|
|
199
|
-
short: '7ab515d'
|
|
200
|
-
},
|
|
201
|
-
author: {
|
|
202
|
-
name: 'Me',
|
|
203
|
-
email: 'me@email.com',
|
|
204
|
-
date: 2018-07-22T20:52:44.000Z
|
|
205
|
-
},
|
|
206
|
-
committer: {
|
|
207
|
-
name: 'Me',
|
|
208
|
-
email: 'me@email.com',
|
|
209
|
-
date: 2018-07-22T20:52:44.000Z
|
|
210
|
-
},
|
|
211
|
-
subject: 'feat: a new feature',
|
|
212
|
-
body: 'Description of the new feature',
|
|
213
|
-
hash: '68eb2c4d778050b0701136ca129f837d7ed494d2',
|
|
214
|
-
message: 'feat: a new feature\n\nDescription of the new feature',
|
|
215
|
-
committerDate: 2018-07-22T20:52:44.000Z
|
|
216
|
-
}
|
|
217
|
-
]
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
#### nextRelease
|
|
221
|
-
|
|
222
|
-
Type: `Object`
|
|
223
|
-
|
|
224
|
-
Information related to the newly published release:
|
|
225
|
-
|
|
226
|
-
| Name | Type | Description |
|
|
227
|
-
| ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
228
|
-
| type | `String` | The [semver](https://semver.org) type of the release (`patch`, `minor` or `major`). |
|
|
229
|
-
| version | `String` | The version of the new release. |
|
|
230
|
-
| gitHead | `String` | The sha of the last commit being part of the new release. |
|
|
231
|
-
| gitTag | `String` | The [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) associated with the new release. |
|
|
232
|
-
| notes | `String` | The release notes for the new release. |
|
|
233
|
-
| channel | `String` | The distribution channel on which the next release will be made available (`undefined` for the default distribution channel). |
|
|
234
|
-
|
|
235
|
-
Example:
|
|
236
|
-
|
|
237
|
-
```js
|
|
238
|
-
{
|
|
239
|
-
type: 'minor',
|
|
240
|
-
gitHead: '68eb2c4d778050b0701136ca129f837d7ed494d2',
|
|
241
|
-
version: '1.1.0',
|
|
242
|
-
gitTag: 'v1.1.0',
|
|
243
|
-
notes: 'Release notes for version 1.1.0...',
|
|
244
|
-
channel : 'next'
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
#### releases
|
|
249
|
-
|
|
250
|
-
Type: `Array<Object>`
|
|
251
|
-
|
|
252
|
-
The list of releases published or made available to a distribution channel.<br>
|
|
253
|
-
Each release object has the following properties:
|
|
254
|
-
|
|
255
|
-
| Name | Type | Description |
|
|
256
|
-
| ---------- | -------- | -------------------------------------------------------------------------------------------------------------- |
|
|
257
|
-
| name | `String` | **Optional.** The release name, only if set by the corresponding `publish` plugin. |
|
|
258
|
-
| url | `String` | **Optional.** The release URL, only if set by the corresponding `publish` plugin. |
|
|
259
|
-
| type | `String` | The [semver](https://semver.org) type of the release (`patch`, `minor` or `major`). |
|
|
260
|
-
| version | `String` | The version of the release. |
|
|
261
|
-
| gitHead | `String` | The sha of the last commit being part of the release. |
|
|
262
|
-
| gitTag | `String` | The [Git tag](https://git-scm.com/book/en/v2/Git-Basics-Tagging) associated with the release. |
|
|
263
|
-
| notes | `String` | The release notes for the release. |
|
|
264
|
-
| pluginName | `String` | The name of the plugin that published the release. |
|
|
265
|
-
| channel | `String` | The distribution channel on which the release is available (`undefined` for the default distribution channel). |
|
|
266
|
-
|
|
267
|
-
Example:
|
|
268
|
-
|
|
269
|
-
```js
|
|
270
|
-
[
|
|
271
|
-
{
|
|
272
|
-
name: 'GitHub release',
|
|
273
|
-
url: 'https://github.com/me/my-package/releases/tag/v1.1.0',
|
|
274
|
-
type: 'minor',
|
|
275
|
-
gitHead: '68eb2c4d778050b0701136ca129f837d7ed494d2',
|
|
276
|
-
version: '1.1.0',
|
|
277
|
-
gitTag: 'v1.1.0',
|
|
278
|
-
notes: 'Release notes for version 1.1.0...',
|
|
279
|
-
pluginName: '@semantic-release/github'
|
|
280
|
-
channel: 'next'
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
name: 'npm package (@latest dist-tag)',
|
|
284
|
-
url: 'https://www.npmjs.com/package/my-package',
|
|
285
|
-
type: 'minor',
|
|
286
|
-
gitHead: '68eb2c4d778050b0701136ca129f837d7ed494d2',
|
|
287
|
-
version: '1.1.0',
|
|
288
|
-
gitTag: 'v1.1.0',
|
|
289
|
-
notes: 'Release notes for version 1.1.0...',
|
|
290
|
-
pluginName: '@semantic-release/npm'
|
|
291
|
-
channel: 'next'
|
|
292
|
-
}
|
|
293
|
-
]
|
|
294
|
-
```
|