semantic-release 19.0.5 → 20.0.0-beta.1
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/bin/semantic-release.js +15 -13
- package/cli.js +11 -11
- package/docs/extending/plugins-list.md +4 -0
- package/docs/support/troubleshooting.md +2 -2
- package/docs/usage/ci-configuration.md +1 -1
- package/docs/usage/configuration.md +3 -3
- package/index.js +27 -24
- package/lib/branches/expand.js +5 -5
- package/lib/branches/get-tags.js +10 -7
- package/lib/branches/index.js +11 -11
- package/lib/branches/normalize.js +13 -16
- package/lib/definitions/branches.js +6 -8
- package/lib/definitions/constants.js +9 -21
- package/lib/definitions/errors.js +120 -54
- package/lib/definitions/plugins.js +6 -6
- package/lib/get-commits.js +6 -4
- package/lib/get-config.js +25 -16
- package/lib/get-error.js +4 -4
- package/lib/get-git-auth-url.js +9 -7
- package/lib/get-last-release.js +6 -6
- package/lib/get-logger.js +6 -4
- package/lib/get-next-version.js +5 -5
- package/lib/get-release-to-add.js +7 -7
- package/lib/git.js +26 -46
- package/lib/hide-sensitive.js +4 -4
- package/lib/plugins/index.js +36 -26
- package/lib/plugins/normalize.js +11 -9
- package/lib/plugins/pipeline.js +6 -6
- package/lib/plugins/utils.js +14 -10
- package/lib/utils.js +19 -37
- package/lib/verify.js +6 -6
- package/package.json +37 -31
package/bin/semantic-release.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
// Bad news: We have to write plain ES5 in this file
|
|
4
|
-
// Good news: It's the only file of the entire project
|
|
5
|
-
|
|
6
3
|
/* eslint-disable no-var */
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
+
|
|
11
|
+
const require = createRequire(import.meta.url);
|
|
12
|
+
const { engines } = require('../package.json');
|
|
13
|
+
const { satisfies, lt } = semver;
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
const MIN_GIT_VERSION = '2.7.1';
|
|
14
16
|
|
|
15
|
-
if (!
|
|
17
|
+
if (!satisfies(process.version, engines.node)) {
|
|
16
18
|
console.error(
|
|
17
|
-
`[semantic-release]: node version ${
|
|
19
|
+
`[semantic-release]: node version ${engines.node} is required. Found ${process.version}.
|
|
18
20
|
|
|
19
21
|
See https://github.com/semantic-release/semantic-release/blob/master/docs/support/node-version.md for more details and solutions.`
|
|
20
22
|
);
|
|
@@ -23,8 +25,8 @@ See https://github.com/semantic-release/semantic-release/blob/master/docs/suppor
|
|
|
23
25
|
|
|
24
26
|
execa('git', ['--version'])
|
|
25
27
|
.then(({stdout}) => {
|
|
26
|
-
|
|
27
|
-
if (
|
|
28
|
+
const gitVersion = findVersions(stdout)[0];
|
|
29
|
+
if (lt(gitVersion, MIN_GIT_VERSION)) {
|
|
28
30
|
console.error(`[semantic-release]: Git version ${MIN_GIT_VERSION} is required. Found ${gitVersion}.`);
|
|
29
31
|
process.exit(1);
|
|
30
32
|
}
|
|
@@ -36,7 +38,7 @@ execa('git', ['--version'])
|
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
// Node 10+ from this point on
|
|
39
|
-
|
|
41
|
+
cli()
|
|
40
42
|
.then((exitCode) => {
|
|
41
43
|
process.exitCode = exitCode;
|
|
42
44
|
})
|
package/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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';
|
|
4
5
|
|
|
5
6
|
const stringList = {
|
|
6
7
|
type: 'string',
|
|
@@ -11,8 +12,8 @@ const stringList = {
|
|
|
11
12
|
: values.reduce((values, value) => values.concat(value.split(',').map((value) => value.trim())), []),
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
const cli =
|
|
15
|
+
export default async () => {
|
|
16
|
+
const cli = yargs(hideBin(process.argv))
|
|
16
17
|
.command('$0', 'Run automated package publishing', (yargs) => {
|
|
17
18
|
yargs.demandCommand(0, 0).usage(`Run automated package publishing
|
|
18
19
|
|
|
@@ -36,12 +37,11 @@ Usage:
|
|
|
36
37
|
.option('debug', {describe: 'Output debugging information', type: 'boolean', group: 'Options'})
|
|
37
38
|
.option('d', {alias: 'dry-run', describe: 'Skip publishing', type: 'boolean', group: 'Options'})
|
|
38
39
|
.option('h', {alias: 'help', group: 'Options'})
|
|
39
|
-
.option('v', {alias: 'version', group: 'Options'})
|
|
40
40
|
.strict(false)
|
|
41
41
|
.exitProcess(false);
|
|
42
42
|
|
|
43
43
|
try {
|
|
44
|
-
const {help, version, ...options} = cli.parse(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
|
-
|
|
52
|
+
(await import('debug')).default.enable('semantic-release:*');
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
await
|
|
55
|
+
await (await import('./index.js')).default(options);
|
|
56
56
|
return 0;
|
|
57
57
|
} catch (error) {
|
|
58
58
|
if (error.name !== 'YError') {
|
|
59
|
-
stderr.write(hideSensitive(env)(util.inspect(error, {colors: true})));
|
|
59
|
+
process.stderr.write(hideSensitive(process.env)(util.inspect(error, {colors: true})));
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
return 1;
|
|
63
63
|
}
|
|
64
|
-
}
|
|
64
|
+
}
|
|
@@ -166,3 +166,7 @@
|
|
|
166
166
|
- [semantic-release-react-native](https://github.com/alexandermendes/semantic-release-react-native)
|
|
167
167
|
- `verifyConditions` Validate configuration.
|
|
168
168
|
- `prepare` Version native iOS and Android files.
|
|
169
|
+
- [semantic-release-cargo](https://github.com/buehler/semantic-release-cargo)
|
|
170
|
+
- `verifyConditions` Validate configuration, `Cargo.toml`, and local cargo executable. Also, logs in into `crates.io`.
|
|
171
|
+
- `prepare` Write the new version number into `Cargo.toml` file and perform `cargo check` if configured.
|
|
172
|
+
- `publish` Publish the Rust crate to `crates.io`
|
|
@@ -30,7 +30,7 @@ When [squashing commits](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-Hist
|
|
|
30
30
|
|
|
31
31
|
When squashing commits make sure to rewrite the resulting commit message to be compliant with the project's commit message convention.
|
|
32
32
|
|
|
33
|
-
**Note**: if the resulting squashed commit
|
|
33
|
+
**Note**: if the resulting squashed commit encompasses multiple changes (for example multiple unrelated features or fixes) then it's probably not a good idea to squash those commits together. A commit should contain exactly one self-contained functional change and a functional change should be contained in exactly one commit. See [atomic commits](https://en.wikipedia.org/wiki/Atomic_commit).
|
|
34
34
|
|
|
35
35
|
## `reference already exists` error when pushing tag
|
|
36
36
|
|
|
@@ -63,7 +63,7 @@ After a git history rewrite due to a `git push --force`, the git tags and notes
|
|
|
63
63
|
|
|
64
64
|
To recover from that situation, do the following:
|
|
65
65
|
|
|
66
|
-
1. Delete the tag(s) for the release(s) that have been lost from the git history. You can delete each tag from remote using `git push origin :[TAG NAME]`, e.g. `git push origin :v2.0.0-beta.1`. You can delete tags locally using `git tag -d [TAG NAME]`, e.g. `git tag -d v2.0.0-beta.1`.
|
|
66
|
+
1. Delete the tag(s) for the release(s) that have been lost from the git history. You can delete each tag from remote using `git push origin -d :[TAG NAME]`, e.g. `git push origin -d :v2.0.0-beta.1`. You can delete tags locally using `git tag -d [TAG NAME]`, e.g. `git tag -d v2.0.0-beta.1`.
|
|
67
67
|
2. Re-create the tags locally: `git tag [TAG NAME] [COMMIT HASH]`, where `[COMMIT HASH]` is the new commit that created the release for the lost tag. E.g. `git tag v2.0.0-beta.1 abcdef0`
|
|
68
68
|
3. Re-create the git notes for each release tag, e.g. `git notes --ref semantic-release add -f -m '{"channels":["beta"]}' v2.0.0-beta.1`. If the release was also published in the default channel (usually `master`), then set the first channel to `null`, e.g. `git notes --ref semantic-release add -f -m '{"channels":[null, "beta"]}'`
|
|
69
69
|
4. Push the local notes: `git push --force origin refs/notes/semantic-release`. The `--force` is needed after the rebase. Be careful.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Run `semantic-release` only after all tests succeeded
|
|
4
4
|
|
|
5
5
|
The `semantic-release` command must be executed only after all the tests in the CI build pass. If the build runs multiple jobs (for example to test on multiple Operating Systems or Node versions) the CI has to be configured to guarantee that the `semantic-release` command is executed only after all jobs are successful.
|
|
6
|
-
Here
|
|
6
|
+
Here are a few examples of the CI services that can be used to achieve this:
|
|
7
7
|
- [Travis Build Stages](https://docs.travis-ci.com/user/build-stages)
|
|
8
8
|
- [CircleCI Workflows](https://circleci.com/docs/2.0/workflows)
|
|
9
9
|
- [GitHub Actions](https://github.com/features/actions)
|
|
@@ -12,8 +12,8 @@ Additionally, metadata of Git tags generated by **semantic-release** can be cust
|
|
|
12
12
|
## Configuration file
|
|
13
13
|
|
|
14
14
|
**semantic-release**’s [options](#options), mode and [plugins](plugins.md) can be set via either:
|
|
15
|
-
- A `.releaserc` file, written in YAML or JSON, with optional extensions:
|
|
16
|
-
- A `release.config.js` file that exports an object
|
|
15
|
+
- A `.releaserc` file, written in YAML or JSON, with optional extensions: `.yaml`/`.yml`/`.json`/`.js`/`.cjs`
|
|
16
|
+
- A `release.config.(js|cjs)` file that exports an object
|
|
17
17
|
- A `release` key in the project's `package.json` file
|
|
18
18
|
|
|
19
19
|
Alternatively, some options can be set via CLI arguments.
|
|
@@ -45,7 +45,7 @@ $ semantic-release --branches next
|
|
|
45
45
|
|
|
46
46
|
**Note**: Plugin options cannot be defined via CLI arguments and must be defined in the configuration file.
|
|
47
47
|
|
|
48
|
-
**Note**: When configuring via `package.json`, the configuration must be under the `release` property. However, when using a `.releaserc` or a `release.config
|
|
48
|
+
**Note**: When configuring via `package.json`, the configuration must be under the `release` property. However, when using a `.releaserc` or a `release.config` file, the configuration must be set without a `release` property.
|
|
49
49
|
|
|
50
50
|
## Options
|
|
51
51
|
|
package/index.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import {createRequire} from 'node:module';
|
|
2
|
+
import {pick} from 'lodash-es';
|
|
3
|
+
import * as marked from 'marked';
|
|
4
|
+
import envCi from 'env-ci';
|
|
5
|
+
import {hookStdout} from 'hook-std';
|
|
6
|
+
import semver from 'semver';
|
|
7
|
+
import AggregateError from 'aggregate-error';
|
|
8
|
+
import hideSensitive from './lib/hide-sensitive.js';
|
|
9
|
+
import getConfig from './lib/get-config.js';
|
|
10
|
+
import verify from './lib/verify.js';
|
|
11
|
+
import getNextVersion from './lib/get-next-version.js';
|
|
12
|
+
import getCommits from './lib/get-commits.js';
|
|
13
|
+
import getLastRelease from './lib/get-last-release.js';
|
|
14
|
+
import getReleaseToAdd from './lib/get-release-to-add.js';
|
|
15
|
+
import {extractErrors, makeTag} from './lib/utils.js';
|
|
16
|
+
import getGitAuthUrl from './lib/get-git-auth-url.js';
|
|
17
|
+
import getBranches from './lib/branches/index.js';
|
|
18
|
+
import getLogger from './lib/get-logger.js';
|
|
19
|
+
import {addNote, getGitHead, getTagHead, isBranchUpToDate, push, pushNotes, tag, verifyAuth} from './lib/git.js';
|
|
20
|
+
import getError from './lib/get-error.js';
|
|
21
|
+
import {COMMIT_EMAIL, COMMIT_NAME} from './lib/definitions/constants.js';
|
|
22
|
+
|
|
23
|
+
const require = createRequire(import.meta.url);
|
|
7
24
|
const pkg = require('./package.json');
|
|
8
|
-
const hideSensitive = require('./lib/hide-sensitive');
|
|
9
|
-
const getConfig = require('./lib/get-config');
|
|
10
|
-
const verify = require('./lib/verify');
|
|
11
|
-
const getNextVersion = require('./lib/get-next-version');
|
|
12
|
-
const getCommits = require('./lib/get-commits');
|
|
13
|
-
const getLastRelease = require('./lib/get-last-release');
|
|
14
|
-
const getReleaseToAdd = require('./lib/get-release-to-add');
|
|
15
|
-
const {extractErrors, makeTag} = require('./lib/utils');
|
|
16
|
-
const getGitAuthUrl = require('./lib/get-git-auth-url');
|
|
17
|
-
const getBranches = require('./lib/branches');
|
|
18
|
-
const getLogger = require('./lib/get-logger');
|
|
19
|
-
const {verifyAuth, isBranchUpToDate, getGitHead, tag, push, pushNotes, getTagHead, addNote} = require('./lib/git');
|
|
20
|
-
const getError = require('./lib/get-error');
|
|
21
|
-
const {COMMIT_NAME, COMMIT_EMAIL} = require('./lib/definitions/constants');
|
|
22
25
|
|
|
23
26
|
let markedOptionsSet = false;
|
|
24
27
|
async function terminalOutput(text) {
|
|
@@ -41,7 +44,7 @@ async function run(context, plugins) {
|
|
|
41
44
|
logger.warn('This run was not triggered in a known CI environment, running in dry-run mode.');
|
|
42
45
|
options.dryRun = true;
|
|
43
46
|
} else {
|
|
44
|
-
// When running on CI, set the commits author and
|
|
47
|
+
// When running on CI, set the commits author and committer info and prevent the `git` CLI to prompt for username/password. See #703.
|
|
45
48
|
Object.assign(env, {
|
|
46
49
|
GIT_AUTHOR_NAME: COMMIT_NAME,
|
|
47
50
|
GIT_AUTHOR_EMAIL: COMMIT_EMAIL,
|
|
@@ -247,8 +250,8 @@ async function callFail(context, plugins, err) {
|
|
|
247
250
|
}
|
|
248
251
|
}
|
|
249
252
|
|
|
250
|
-
|
|
251
|
-
const {unhook} =
|
|
253
|
+
export default async (cliOptions = {}, {cwd = process.cwd(), env = process.env, stdout, stderr} = {}) => {
|
|
254
|
+
const {unhook} = hookStdout(
|
|
252
255
|
{silent: false, streams: [process.stdout, process.stderr, stdout, stderr].filter(Boolean)},
|
|
253
256
|
hideSensitive(env)
|
|
254
257
|
);
|
|
@@ -278,4 +281,4 @@ module.exports = async (cliOptions = {}, {cwd = process.cwd(), env = process.env
|
|
|
278
281
|
unhook();
|
|
279
282
|
throw error;
|
|
280
283
|
}
|
|
281
|
-
}
|
|
284
|
+
}
|
package/lib/branches/expand.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {isString, mapValues, omit, remove, template} from 'lodash-es';
|
|
2
|
+
import micromatch from 'micromatch';
|
|
3
|
+
import {getBranches} from '../git.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export default async (repositoryUrl, {cwd}, branches) => {
|
|
6
6
|
const gitBranches = await getBranches(repositoryUrl, {cwd});
|
|
7
7
|
|
|
8
8
|
return branches.reduce(
|
|
@@ -15,4 +15,4 @@ module.exports = async (repositoryUrl, {cwd}, branches) => {
|
|
|
15
15
|
],
|
|
16
16
|
[]
|
|
17
17
|
);
|
|
18
|
-
}
|
|
18
|
+
}
|
package/lib/branches/get-tags.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import {escapeRegExp, template} from 'lodash-es';
|
|
2
|
+
import semver from 'semver';
|
|
3
|
+
import pReduce from 'p-reduce';
|
|
4
|
+
import debugTags from 'debug';
|
|
5
|
+
import {getNote, getTags} from '../../lib/git.js';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const debug = debugTags('semantic-release:get-tags');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export default async ({cwd, env, options: {tagFormat}}, branches) => {
|
|
8
11
|
// Generate a regex to parse tags formatted with `tagFormat`
|
|
9
12
|
// by replacing the `version` variable in the template by `(.+)`.
|
|
10
13
|
// The `tagFormat` is compiled with space as the `version` as it's an invalid tag character,
|
|
@@ -30,4 +33,4 @@ module.exports = async ({cwd, env, options: {tagFormat}}, branches) => {
|
|
|
30
33
|
},
|
|
31
34
|
[]
|
|
32
35
|
);
|
|
33
|
-
}
|
|
36
|
+
}
|
package/lib/branches/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import {isRegExp, isString} from 'lodash-es';
|
|
2
|
+
import AggregateError from 'aggregate-error';
|
|
3
|
+
import pEachSeries from 'p-each-series';
|
|
4
|
+
import * as DEFINITIONS from '../definitions/branches.js';
|
|
5
|
+
import getError from '../get-error.js';
|
|
6
|
+
import {fetch, fetchNotes, verifyBranchName} from '../git.js';
|
|
7
|
+
import expand from './expand.js';
|
|
8
|
+
import getTags from './get-tags.js';
|
|
9
|
+
import * as normalize from './normalize.js';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
export default async (repositoryUrl, ciBranch, context) => {
|
|
12
12
|
const {cwd, env} = context;
|
|
13
13
|
|
|
14
14
|
const remoteBranches = await expand(
|
|
@@ -68,4 +68,4 @@ module.exports = async (repositoryUrl, ciBranch, context) => {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
return [...result.maintenance, ...result.release, ...result.prerelease];
|
|
71
|
-
}
|
|
71
|
+
}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import {isNil, sortBy} from 'lodash-es';
|
|
2
|
+
import semverDiff from 'semver-diff';
|
|
3
|
+
import {FIRST_RELEASE, RELEASE_TYPE} from '../definitions/constants.js';
|
|
4
|
+
import {
|
|
5
|
+
getFirstVersion,
|
|
6
|
+
getLatestVersion,
|
|
7
|
+
getLowerBound, getRange,
|
|
7
8
|
getUpperBound,
|
|
8
|
-
getLowerBound,
|
|
9
9
|
highest,
|
|
10
|
+
isMajorRange,
|
|
10
11
|
lowest,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
getRange,
|
|
14
|
-
} = require('../utils');
|
|
12
|
+
tagsToVersions
|
|
13
|
+
} from '../utils.js';
|
|
15
14
|
|
|
16
|
-
function maintenance({maintenance, release}) {
|
|
15
|
+
export function maintenance({maintenance, release}) {
|
|
17
16
|
return sortBy(
|
|
18
17
|
maintenance.map(({name, range, channel, ...rest}) => ({
|
|
19
18
|
...rest,
|
|
@@ -55,7 +54,7 @@ function maintenance({maintenance, release}) {
|
|
|
55
54
|
});
|
|
56
55
|
}
|
|
57
56
|
|
|
58
|
-
function release({release}) {
|
|
57
|
+
export function release({release}) {
|
|
59
58
|
if (release.length === 0) {
|
|
60
59
|
return release;
|
|
61
60
|
}
|
|
@@ -89,7 +88,7 @@ function release({release}) {
|
|
|
89
88
|
});
|
|
90
89
|
}
|
|
91
90
|
|
|
92
|
-
function prerelease({prerelease}) {
|
|
91
|
+
export function prerelease({prerelease}) {
|
|
93
92
|
return prerelease.map(({name, prerelease, channel, tags, ...rest}) => {
|
|
94
93
|
const preid = prerelease === true ? name : prerelease;
|
|
95
94
|
return {
|
|
@@ -102,5 +101,3 @@ function prerelease({prerelease}) {
|
|
|
102
101
|
};
|
|
103
102
|
});
|
|
104
103
|
}
|
|
105
|
-
|
|
106
|
-
module.exports = {maintenance, release, prerelease};
|
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import {isNil, uniqBy} from 'lodash-es';
|
|
2
|
+
import semver from 'semver';
|
|
3
|
+
import {isMaintenanceRange} from '../utils.js';
|
|
4
4
|
|
|
5
|
-
const maintenance = {
|
|
5
|
+
export const maintenance = {
|
|
6
6
|
filter: ({name, range}) => (!isNil(range) && range !== false) || isMaintenanceRange(name),
|
|
7
7
|
branchValidator: ({range}) => (isNil(range) ? true : isMaintenanceRange(range)),
|
|
8
8
|
branchesValidator: (branches) => uniqBy(branches, ({range}) => semver.validRange(range)).length === branches.length,
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
const prerelease = {
|
|
11
|
+
export const prerelease = {
|
|
12
12
|
filter: ({prerelease}) => !isNil(prerelease) && prerelease !== false,
|
|
13
13
|
branchValidator: ({name, prerelease}) =>
|
|
14
14
|
Boolean(prerelease) && Boolean(semver.valid(`1.0.0-${prerelease === true ? name : prerelease}.1`)),
|
|
15
15
|
branchesValidator: (branches) => uniqBy(branches, 'prerelease').length === branches.length,
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
const release = {
|
|
18
|
+
export const release = {
|
|
19
19
|
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
|
|
20
20
|
filter: (branch) => !maintenance.filter(branch) && !prerelease.filter(branch),
|
|
21
21
|
branchesValidator: (branches) => branches.length <= 3 && branches.length > 0,
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
module.exports = {maintenance, prerelease, release};
|
|
@@ -1,29 +1,17 @@
|
|
|
1
|
-
const RELEASE_TYPE = ['patch', 'minor', 'major'];
|
|
1
|
+
export const RELEASE_TYPE = ['patch', 'minor', 'major'];
|
|
2
2
|
|
|
3
|
-
const FIRST_RELEASE = '1.0.0';
|
|
3
|
+
export const FIRST_RELEASE = '1.0.0';
|
|
4
4
|
|
|
5
|
-
const FIRSTPRERELEASE = '1';
|
|
5
|
+
export const FIRSTPRERELEASE = '1';
|
|
6
6
|
|
|
7
|
-
const COMMIT_NAME = 'semantic-release-bot';
|
|
7
|
+
export const COMMIT_NAME = 'semantic-release-bot';
|
|
8
8
|
|
|
9
|
-
const COMMIT_EMAIL = 'semantic-release-bot@martynus.net';
|
|
9
|
+
export const COMMIT_EMAIL = 'semantic-release-bot@martynus.net';
|
|
10
10
|
|
|
11
|
-
const RELEASE_NOTES_SEPARATOR = '\n\n';
|
|
11
|
+
export const RELEASE_NOTES_SEPARATOR = '\n\n';
|
|
12
12
|
|
|
13
|
-
const SECRET_REPLACEMENT = '[secure]';
|
|
13
|
+
export const SECRET_REPLACEMENT = '[secure]';
|
|
14
14
|
|
|
15
|
-
const SECRET_MIN_SIZE = 5;
|
|
15
|
+
export const SECRET_MIN_SIZE = 5;
|
|
16
16
|
|
|
17
|
-
const GIT_NOTE_REF = 'semantic-release';
|
|
18
|
-
|
|
19
|
-
module.exports = {
|
|
20
|
-
RELEASE_TYPE,
|
|
21
|
-
FIRST_RELEASE,
|
|
22
|
-
FIRSTPRERELEASE,
|
|
23
|
-
COMMIT_NAME,
|
|
24
|
-
COMMIT_EMAIL,
|
|
25
|
-
RELEASE_NOTES_SEPARATOR,
|
|
26
|
-
SECRET_REPLACEMENT,
|
|
27
|
-
SECRET_MIN_SIZE,
|
|
28
|
-
GIT_NOTE_REF,
|
|
29
|
-
};
|
|
17
|
+
export const GIT_NOTE_REF = 'semantic-release';
|