Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
58a226f29c | ||
|
|
17d60d310e | ||
|
|
ab45ab1f8d | ||
|
|
ea389c3c88 | ||
|
|
fa994db054 | ||
|
|
b79116bf6d | ||
|
|
6fd7e56eb8 | ||
|
|
2b94bb4e09 | ||
|
|
b4bc1918cb | ||
|
|
2c30e268f9 | ||
|
|
0eca144bad |
@@ -22,14 +22,12 @@ Finally, we call our release job with a `requires` parameter so that `release` w
|
||||
```yaml
|
||||
version: 2.1
|
||||
orbs:
|
||||
node: circleci/node@4.5
|
||||
node: circleci/node@5.0.0
|
||||
jobs:
|
||||
release:
|
||||
executor: node/default
|
||||
steps:
|
||||
- checkout
|
||||
- node/install
|
||||
lts: true
|
||||
- node/install-packages # Install and automatically cache packages
|
||||
# Run optional required steps before releasing
|
||||
# - run: npm run build-script
|
||||
|
||||
@@ -13,7 +13,7 @@ Here is a few example of the CI services that can be used to achieve this:
|
||||
- [Wercker Workflows](http://devcenter.wercker.com/docs/workflows)
|
||||
- [GoCD Pipelines](https://docs.gocd.org/current/introduction/concepts_in_go.html#pipeline).
|
||||
|
||||
See [CI configuration recipes](../recipes/ci-configurations/README.md) for more details.
|
||||
See [CI configuration recipes](../recipes/ci-configurations#ci-configurations) for more details.
|
||||
|
||||
## Authentication
|
||||
|
||||
@@ -44,6 +44,6 @@ See each plugin's documentation for the environment variables required.
|
||||
|
||||
The authentication token/credentials have to be made available in the CI service via environment variables.
|
||||
|
||||
See [CI configuration recipes](../recipes/ci-configurations/README.md) for more details on how to configure environment variables in your CI service.
|
||||
See [CI configuration recipes](../recipes/ci-configurations#ci-configurations) for more details on how to configure environment variables in your CI service.
|
||||
|
||||
**Note**: The environment variables `GH_TOKEN`, `GITHUB_TOKEN`, `GL_TOKEN` and `GITLAB_TOKEN` can be used for both the Git authentication and the API authentication required by [@semantic-release/github](https://github.com/semantic-release/github) and [@semantic-release/gitlab](https://github.com/semantic-release/gitlab).
|
||||
|
||||
@@ -75,7 +75,7 @@ async function run(context, plugins) {
|
||||
}
|
||||
|
||||
logger[options.dryRun ? 'warn' : 'success'](
|
||||
`Run automated release from branch ${ciBranch} on repository ${options.repositoryUrl}${
|
||||
`Run automated release from branch ${ciBranch} on repository ${options.originalRepositoryURL}${
|
||||
options.dryRun ? ' in dry-run mode' : ''
|
||||
}`
|
||||
);
|
||||
@@ -263,6 +263,7 @@ module.exports = async (cliOptions = {}, {cwd = process.cwd(), env = process.env
|
||||
context.logger.log(`Running ${pkg.name} version ${pkg.version}`);
|
||||
try {
|
||||
const {plugins, options} = await getConfig(context, cliOptions);
|
||||
options.originalRepositoryURL = options.repositoryUrl;
|
||||
context.options = options;
|
||||
try {
|
||||
const result = await run(context, plugins);
|
||||
|
||||
@@ -27,6 +27,7 @@ module.exports = async (repositoryUrl, ciBranch, context) => {
|
||||
|
||||
const errors = [];
|
||||
const branchesByType = Object.entries(DEFINITIONS).reduce(
|
||||
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
|
||||
(branchesByType, [type, {filter}]) => ({[type]: branches.filter(filter), ...branchesByType}),
|
||||
{}
|
||||
);
|
||||
|
||||
@@ -16,6 +16,7 @@ const prerelease = {
|
||||
};
|
||||
|
||||
const release = {
|
||||
// eslint-disable-next-line unicorn/no-fn-reference-in-iterator
|
||||
filter: (branch) => !maintenance.filter(branch) && !prerelease.filter(branch),
|
||||
branchesValidator: (branches) => branches.length <= 3 && branches.length > 0,
|
||||
};
|
||||
|
||||
@@ -89,7 +89,7 @@ module.exports = async (context) => {
|
||||
try {
|
||||
debug('Verifying ssh auth by attempting to push to %s', repositoryUrl);
|
||||
await verifyAuth(repositoryUrl, branch.name, {cwd, env});
|
||||
} catch (_) {
|
||||
} catch {
|
||||
debug('SSH key auth failed, falling back to https.');
|
||||
const envVars = Object.keys(GIT_TOKENS).filter((envVar) => !isNil(env[envVar]));
|
||||
|
||||
|
||||
+2
-2
@@ -116,7 +116,7 @@ async function fetch(repositoryUrl, branch, ciBranch, execaOptions) {
|
||||
],
|
||||
execaOptions
|
||||
);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
await execa(
|
||||
'git',
|
||||
[
|
||||
@@ -144,7 +144,7 @@ async function fetchNotes(repositoryUrl, execaOptions) {
|
||||
['fetch', '--unshallow', repositoryUrl, `+refs/notes/${GIT_NOTE_REF}:refs/notes/${GIT_NOTE_REF}`],
|
||||
execaOptions
|
||||
);
|
||||
} catch (_) {
|
||||
} catch {
|
||||
await execa('git', ['fetch', repositoryUrl, `+refs/notes/${GIT_NOTE_REF}:refs/notes/${GIT_NOTE_REF}`], {
|
||||
...execaOptions,
|
||||
reject: false,
|
||||
|
||||
Generated
+4551
-2626
File diff suppressed because it is too large
Load Diff
+3
-2
@@ -23,7 +23,7 @@
|
||||
"@semantic-release/commit-analyzer": "^9.0.2",
|
||||
"@semantic-release/error": "^3.0.0",
|
||||
"@semantic-release/github": "^8.0.0",
|
||||
"@semantic-release/npm": "^9.0.0-beta.3",
|
||||
"@semantic-release/npm": "^9.0.0",
|
||||
"@semantic-release/release-notes-generator": "^10.0.0",
|
||||
"aggregate-error": "^3.0.0",
|
||||
"cosmiconfig": "^7.0.0",
|
||||
@@ -67,7 +67,7 @@
|
||||
"sinon": "12.0.1",
|
||||
"stream-buffers": "3.0.2",
|
||||
"tempy": "1.0.1",
|
||||
"xo": "0.29.1"
|
||||
"xo": "0.32.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=16 || ^14.17"
|
||||
@@ -129,6 +129,7 @@
|
||||
"prettier": true,
|
||||
"space": true,
|
||||
"rules": {
|
||||
"unicorn/no-reduce": "off",
|
||||
"unicorn/string-content": "off"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ const test = require('ava');
|
||||
const {maintenance, prerelease, release} = require('../../lib/definitions/branches');
|
||||
|
||||
test('A "maintenance" branch is identified by having a "range" property or a "name" formatted like "N.x", "N.x.x" or "N.N.x"', (t) => {
|
||||
/* eslint-disable unicorn/no-fn-reference-in-iterator */
|
||||
t.true(maintenance.filter({name: '1.x.x'}));
|
||||
t.true(maintenance.filter({name: '1.0.x'}));
|
||||
t.true(maintenance.filter({name: '1.x'}));
|
||||
@@ -15,6 +16,7 @@ test('A "maintenance" branch is identified by having a "range" property or a "na
|
||||
t.false(maintenance.filter({name: 'some-name'}));
|
||||
t.false(maintenance.filter({name: '1.0.0'}));
|
||||
t.false(maintenance.filter({name: 'x.x.x'}));
|
||||
/* eslint-enable unicorn/no-fn-reference-in-iterator */
|
||||
});
|
||||
|
||||
test('A "maintenance" branches must have a "range" property formatted like "N.x", "N.x.x" or "N.N.x"', (t) => {
|
||||
@@ -37,6 +39,7 @@ test('The "maintenance" branches must have unique ranges', (t) => {
|
||||
});
|
||||
|
||||
test('A "prerelease" branch is identified by having a thruthy "prerelease" property', (t) => {
|
||||
/* eslint-disable unicorn/no-fn-reference-in-iterator */
|
||||
t.true(prerelease.filter({name: 'some-name', prerelease: true}));
|
||||
t.true(prerelease.filter({name: 'some-name', prerelease: 'beta'}));
|
||||
t.true(prerelease.filter({name: 'some-name', prerelease: ''}));
|
||||
@@ -44,6 +47,7 @@ test('A "prerelease" branch is identified by having a thruthy "prerelease" prope
|
||||
t.false(prerelease.filter({name: 'some-name', prerelease: null}));
|
||||
t.false(prerelease.filter({name: 'some-name', prerelease: false}));
|
||||
t.false(prerelease.filter({name: 'some-name'}));
|
||||
/* eslint-enable unicorn/no-fn-reference-in-iterator */
|
||||
});
|
||||
|
||||
test('A "prerelease" branch must have a valid prerelease detonation in "prerelease" property or in "name" if "prerelease" is "true"', (t) => {
|
||||
@@ -66,6 +70,7 @@ test('The "prerelease" branches must have unique "prerelease" property', (t) =>
|
||||
});
|
||||
|
||||
test('A "release" branch is identified by not havin a "range" or "prerelease" property or a "name" formatted like "N.x", "N.x.x" or "N.N.x"', (t) => {
|
||||
/* eslint-disable unicorn/no-fn-reference-in-iterator */
|
||||
t.true(release.filter({name: 'some-name'}));
|
||||
|
||||
t.false(release.filter({name: '1.x.x'}));
|
||||
@@ -74,6 +79,7 @@ test('A "release" branch is identified by not havin a "range" or "prerelease" pr
|
||||
t.false(release.filter({name: 'some-name', range: '1.1.x'}));
|
||||
t.false(release.filter({name: 'some-name', prerelease: true}));
|
||||
t.false(release.filter({name: 'some-name', prerelease: 'beta'}));
|
||||
/* eslint-enable unicorn/no-fn-reference-in-iterator */
|
||||
});
|
||||
|
||||
test('There must be between 1 and 3 release branches', (t) => {
|
||||
|
||||
@@ -30,7 +30,7 @@ async function start() {
|
||||
minTimeout: 1000,
|
||||
factor: 2,
|
||||
});
|
||||
} catch (_) {
|
||||
} catch {
|
||||
throw new Error(`Couldn't start mock-server after 2 min`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ async function start() {
|
||||
minTimeout: 1000,
|
||||
factor: 2,
|
||||
});
|
||||
} catch (_) {
|
||||
} catch {
|
||||
throw new Error(`Couldn't start npm-registry-docker after 2 min`);
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -90,6 +90,7 @@ test('Plugins are called with expected values', async (t) => {
|
||||
const config = {
|
||||
branches: [{name: 'master'}, {name: 'next'}],
|
||||
repositoryUrl,
|
||||
originalRepositoryURL: repositoryUrl,
|
||||
globalOpt: 'global',
|
||||
tagFormat: `v\${version}`,
|
||||
};
|
||||
@@ -927,7 +928,12 @@ test('Log all "verifyConditions" errors', async (t) => {
|
||||
const error2 = new SemanticReleaseError('error 2', 'ERR2');
|
||||
const error3 = new SemanticReleaseError('error 3', 'ERR3');
|
||||
const fail = stub().resolves();
|
||||
const config = {branches: [{name: 'master'}], repositoryUrl, tagFormat: `v\${version}`};
|
||||
const config = {
|
||||
branches: [{name: 'master'}],
|
||||
repositoryUrl,
|
||||
originalRepositoryURL: repositoryUrl,
|
||||
tagFormat: `v\${version}`,
|
||||
};
|
||||
const options = {
|
||||
...config,
|
||||
plugins: false,
|
||||
|
||||
Reference in New Issue
Block a user