Compare commits

...
19 Commits
Author SHA1 Message Date
8262832cda fix(deps): update dependency execa to v5 (#1745)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-01-20 17:00:27 -08:00
cc74a4c890 fix(deps): update dependency cosmiconfig to v7 (#1742)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-01-20 16:59:32 -08:00
a3c49428e3 chore(deps): pin dependencies (#1744)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-01-20 15:42:59 -08:00
d95d80a0aa chore(deps): update actions/setup-node action to v2 (#1741)
Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-01-20 14:19:25 -08:00
b5aa853b22 ci: replace travis with actions, setup renovate (#1699)
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-01-20 14:07:16 -08:00
Josh SorefandGitHub 32a2c91d7c fix: pin initial branch to master (#1740) 2021-01-20 11:20:48 -08:00
Roland WeissandGitHub d2ec8931bc fix(deps): update to yargs 16.2.0 (#1739)
Signed-off-by: Roland Weiss <roland.weiss@mobi.ch>
2021-01-19 08:46:14 -08:00
Thomas ZimmermannandGitHub 9f57b84aaa fix: add logging for top-level errors (#1736) 2021-01-15 14:31:07 -08:00
Vegard ØklandandGitHub c5719101cc docs: clarify node vs npm in FAQ (#1731) thanks @vegardok 2021-01-15 11:50:33 -08:00
Mo SattlerandGitHub 7581aa8584 docs: fix a typo in github-actions.md (#1735) 2021-01-15 09:35:05 -06:00
Dominykas BlyžėandGitHub 21c151f167 fix: normalize ci: false into noCi: true after configs get merged (#1732) thanks @dominykas
This makes sure that options.ci is respected even when set inside a shareable config
2021-01-13 07:38:57 -08:00
Max DuvalandGitHub da75a9c60a docs: clean and strip SVG logo (#1723) thanks @mxdvl 2021-01-04 10:48:15 -08:00
cherryblossom000andGitHub e211499735 docs(plugins): document addChannel step (#1721)
Document the `addChannel` step defined in
https://github.com/semantic-release/semantic-release/blob/e35e5bb73f3628906553709ac0f5beb8f565c61a/lib/definitions/plugins.js#L83-L84,
which is used in @semantic-release/npm.
2020-12-29 12:33:12 -08:00
Ryan LingandGitHub 52238cbccc fix(deps): Require find-versions ^4.0.0 (#1722)
This new version includes a fix for a ReDoS vulnerability in
`semver-regex` that is flagged by some source composition analysis tools
like Snyk:

https://snyk.io/vuln/SNYK-JS-SEMVERREGEX-1047770

It's a major version because it drops support for Node.js 6.x. This
doesn't affect us since we already require Node.js >=10.18.
2020-12-29 12:15:11 -08:00
Jonas BromsandGitHub af596a9443 docs: semantic-release SVG logo (#1715) thanks @bromso
I recreated the logo and used this image as a reference: https://gblobscdn.gitbook.com/spaces%2F-LGsE7zdvzHI5cG-XV6p%2Favatar.png
2020-12-16 14:00:30 -08:00
Mihai PlasoianuandGitHub 6c7e4be68a docs: add semantic-release-helm plugin (#1713) 2020-12-09 09:22:32 -08:00
abichingerandGitHub c177d4b15a docs: add semantic-release-pypi plugin (#1707) 2020-12-02 09:43:00 -08:00
Geoffroy EmpainandGitHub eb708236df docs: add semantic-release-license-plugin (#1701)
This adds a semantic-release-plugin which we use to update our license files (copyright dates and more) based on their type.
2020-11-25 09:25:48 -08:00
AlmenonandGitHub 885d87ac0f feat(docs): note that publish token is required (#1700)
see https://github.com/semantic-release/npm/issues/277
2020-11-22 10:38:15 -08:00
24 changed files with 13767 additions and 126 deletions
+21
View File
@@ -0,0 +1,21 @@
name: Release
on:
push:
branches:
- master
- next
- beta
- "*.x" # maintenance releases branches
jobs:
release:
name: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: bahmutov/npm-install@v1
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.SEMANTIC_RELEASE_BOT_NPM_TOKEN }}
+45
View File
@@ -0,0 +1,45 @@
name: Test
on:
push:
branches:
- master
- renovate/**
pull_request:
types:
- opened
- synchronize
jobs:
test_matrix:
strategy:
matrix:
node-version:
- 10
- 12
- 14
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: git config --global user.name github-actions
- run: git config --global user.email github-actions@github.com
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- uses: bahmutov/npm-install@v1
- run: npm run test:ci
# separate job to set as required in branch protection,
# as the build names above change each time Node versions change
test:
runs-on: ubuntu-latest
needs: test_matrix
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: bahmutov/npm-install@v1
- run: npm run lint
-4
View File
@@ -125,10 +125,6 @@ $RECYCLE.BIN/
# Windows shortcuts
*.lnk
# Lockfiles
package-lock.json
yarn.lock
# Gitbook
_book
-1
View File
@@ -1 +0,0 @@
package-lock=false
-11
View File
@@ -1,11 +0,0 @@
version: ~> 1.0
services:
- docker
import:
- .travis/node.yml
- .travis/node-versions.yml
- .travis/semantic-release.yml
- .travis/greenkeeper.yml
- .travis/codecov.yml
-2
View File
@@ -1,2 +0,0 @@
after_success:
- npm run codecov
-3
View File
@@ -1,3 +0,0 @@
branches:
only:
- /^greenkeeper.*$/
-3
View File
@@ -1,3 +0,0 @@
node_js:
- 12
- 10.18
-11
View File
@@ -1,11 +0,0 @@
language: node_js
cache:
npm: false
# Retry install on fail to avoid failing a build on network/disk/external errors
install:
- travis_retry npm install
script:
- npm run test
-15
View File
@@ -1,15 +0,0 @@
branches:
only:
- master
- next
- beta
- /^\d+\.(\d+|x)(\.x)?$/
jobs:
include:
- stage: release
node_js: lts/*
install:
- travis_retry npm install
script:
- npm run semantic-release
-1
View File
@@ -1 +0,0 @@
--install.no-lockfile true
+6 -11
View File
@@ -4,14 +4,8 @@
<a href="https://spectrum.chat/semantic-release">
<img alt="Join the community on Spectrum" src="https://withspectrum.github.io/badge/badge.svg">
</a>
<a href="https://travis-ci.org/semantic-release/semantic-release">
<img alt="Travis" src="https://img.shields.io/travis/semantic-release/semantic-release/master.svg">
</a>
<a href="https://codecov.io/gh/semantic-release/semantic-release">
<img alt="Codecov" src="https://img.shields.io/codecov/c/github/semantic-release/semantic-release/master.svg">
</a>
<a href="https://greenkeeper.io">
<img alt="Greenkeeper" src="https://badges.greenkeeper.io/semantic-release/semantic-release.svg">
<a href="https://github.com/semantic-release/semantic-release/actions?query=workflow%3ATest+branch%3Amaster">
<img alt="Build states" src="https://github.com/semantic-release/semantic-release/workflows/Test/badge.svg">
</a>
<a href="#badge">
<img alt="semantic-release" src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg">
@@ -61,7 +55,7 @@ Tools such as [commitizen](https://github.com/commitizen/cz-cli) or [commitlint]
Here is an example of the release type that will be done based on a commit messages:
| Commit message | Release type |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------|
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------- |
| `fix(pencil): stop graphite breaking when too much pressure applied` | Patch Release |
| `feat(pencil): add 'graphiteWidth' option` | ~~Minor~~ Feature Release |
| `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 |
@@ -75,6 +69,7 @@ Here is an example of the release type that will be done based on a commit messa
For each new commits added to one of the release branches (for example `master`, `next`, `beta`), with `git push` or by merging a pull request or merging from another branch, a CI build is triggered and runs the `semantic-release` command to make a release if there are codebase changes since the last release that affect the package functionalities.
**semantic-release** offers various ways to control the timing, the content and the audience of published releases. See example workflows in the following recipes:
- [Using distribution channels](docs/recipes/distribution-channels.md#publishing-on-distribution-channels)
- [Maintenance releases](docs/recipes/maintenance-releases.md#publishing-maintenance-releases)
- [Pre-releases](docs/recipes/pre-releases.md#publishing-pre-releases)
@@ -84,7 +79,7 @@ For each new commits added to one of the release branches (for example `master`,
After running the tests, the command `semantic-release` will execute the following steps:
| Step | Description |
|-------------------|---------------------------------------------------------------------------------------------------------------------------------|
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| Verify Conditions | Verify all the conditions to proceed with the release. |
| Get last release | Obtain the commit corresponding to the last release by analyzing [Git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging). |
| Analyze commits | Determine the type of release based on the commits added since the last release. |
@@ -98,6 +93,7 @@ After running the tests, the command `semantic-release` will execute the followi
## Requirements
In order to use **semantic-release** you need:
- To host your code in a [Git repository](https://git-scm.com)
- Use a Continuous Integration service that allows you to [securely set up credentials](docs/usage/ci-configuration.md#authentication)
- Git CLI version [2.7.1 or higher](docs/support/FAQ.md#why-does-semantic-release-require-git-version--271) installed in your Continuous Integration environment
@@ -160,7 +156,6 @@ Let people know that your package is published using **semantic-release** by inc
| ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| [Stephan Bönnemann](https://github.com/boennemann) | [Rolf Erik Lekang](https://github.com/relekang) | [Johannes Jörg Schmidt](https://github.com/jo) | [Finn Pauls](https://github.com/finnp) | [Christoph Witzko](https://github.com/christophwitzko) |
<p align="center">
<img alt="Kill all humans" src="media/bender.png">
</p>
+2 -1
View File
@@ -40,6 +40,7 @@ require('../cli')()
.then((exitCode) => {
process.exitCode = exitCode;
})
.catch(() => {
.catch((error) => {
console.error(error);
process.exitCode = 1;
});
+11
View File
@@ -113,3 +113,14 @@
- `verifyConditions`: Verify the presence and the validity of the npm authentication and release configuration for multiple registries
- `prepare`: Update the package.json version and create the npm package tarball
- `publish`: Publish the package on the npm registry for multiple registries
- [semantic-release-license](https://github.com/cbhq/semantic-release-license) Automatically update dates and more in your license file for new releases.
- `verifyConditions`: Verify the presence of a license file
- `prepare`: Update the license file based on its type
- [semantic-release-pypi](https://github.com/abichinger/semantic-release-pypi)
- `verifyConditions`: Verify the environment variable ```PYPI_TOKEN``` and installation of build tools
- `prepare`: Update the version in ```setup.cfg``` and create the distribution packages
- `publish`: Publish the python package to a repository (default: pypi)
- [semantic-release-helm](https://github.com/m1pl/semantic-release-helm)
- `verifyConditions`: Validate configuration and (if present) credentials
- `prepare`: Update version and appVersion in ```Chart.yaml```
- `publish`: Publish the chart to a registry (if configured)
+2 -2
View File
@@ -4,7 +4,7 @@
The [Authentication](../usage/ci-configuration.md#authentication) environment variables can be configured with [Secret Variables](https://help.github.com/en/articles/virtual-environments-for-github-actions#creating-and-using-secrets-encrypted-variables).
In this example an [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populate](https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret) a [`GITHUB_TOKEN`](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) environment variable which can be used in Workflows.
In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) is required to publish a package to the npm registry. GitHub Actions [automatically populate](https://help.github.com/en/articles/virtual-environments-for-github-actions#github_token-secret) a [`GITHUB_TOKEN`](https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line) environment variable which can be used in Workflows.
## Node project configuration
@@ -50,7 +50,7 @@ To keep `package.json` updated in the `master` branch, [`@semantic-release/git`]
**Note**: Automatically populated `GITHUB_TOKEN` cannot be used if branch protection is enabled for the target branch. It is **not** advised to mitigate this limitation by overriding an automatically populated `GITHUB_TOKEN` variable with a [Personal Access Tokens](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line), as it poses a security risk. Since Secret Variables are available for Workflows triggered by any branch, it becomes a potential vector of attack, where a Workflow triggered from a non-protected branch can expose and use a token with elevated permissions, yielding branch protection insignificant. One can use Personal Access Tokens in trusted environments, where all developers should have the ability to perform administrative actions in the given repository and branch protection is enabled solely for convenience purposes, to remind about required reviews or CI checks.
If the risk is acceptible, some extra configuration is needed. The [actions/checkout `persist-credentials`](https://github.com/marketplace/actions/checkout#usage) option needs to be `false`, otherwise the generated `GITHUB_TOKEN` will interfere with the custom one. Example:
If the risk is acceptable, some extra configuration is needed. The [actions/checkout `persist-credentials`](https://github.com/marketplace/actions/checkout#usage) option needs to be `false`, otherwise the generated `GITHUB_TOKEN` will interfere with the custom one. Example:
```yaml
- name: Checkout
+1 -1
View File
@@ -8,7 +8,7 @@ By default, only the published package will contain the version, which is the on
However, the [`@semantic-release/git`](https://github.com/semantic-release/git) plugin can be used to push the updated `package.json` as well as other files to the Git repository.
If you wish to only update the `package.json` and push via Git you can set the project to `"private": true,` within your `package.json` to prevent publishing to [npm](https://www.npmjs.com). This can be useful for using **semantic-release** with a non-node project.
If you wish to only update the `package.json` and push via Git you can set the project to `"private": true,` within your `package.json` to prevent publishing to [the npm registry](https://www.npmjs.com).
## How can I use a npm build script that requires the `package.json`s version ?
+1
View File
@@ -12,6 +12,7 @@ A plugin is a npm module that can implement one or more of the following steps:
| `generateNotes` | No | Responsible for generating the content of the release note. If multiple plugins with a `generateNotes` step are defined, the release notes will be the result of the concatenation of each plugin output. |
| `prepare` | No | Responsible for preparing the release, for example creating or updating files such as `package.json`, `CHANGELOG.md`, documentation or compiled assets and pushing a commit. |
| `publish` | No | Responsible for publishing the release. |
| `addChannel` | No | Responsible for adding a release channel (e.g. adding an npm dist-tag to a release). |
| `success` | No | Responsible for notifying of a new release. |
| `fail` | No | Responsible for notifying of a failed release. |
+4 -3
View File
@@ -27,9 +27,6 @@ module.exports = async (context, cliOptions) => {
// Merge config file options and CLI/API options
let options = {...config, ...cliOptions};
if (options.ci === false) {
options.noCi = true;
}
const pluginsPath = {};
let extendPaths;
@@ -87,6 +84,10 @@ module.exports = async (context, cliOptions) => {
...(options.branches ? {branches: castArray(options.branches)} : {}),
};
if (options.ci === false) {
options.noCi = true;
}
debug('options values: %O', options);
return {options, plugins: await plugins({...context, options}, pluginsPath)};
+3
View File
@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="15 0 500 500" width="500px" height="500px">
<path fill="#494949" fill-rule="nonzero" d="M265 300a50 50 0 110-100 50 50 0 010 100zm0-15a35 35 0 100-70 35 35 0 000 70zM189 65v36c2 11 21 55 35 81-18-13-58-43-69-58a92 92 0 01-17-29l-71 40v86c9 5 23 15 31 18 11 4 59 9 88 10-21 9-66 29-85 31-16 3-27 1-34 0v85l69 39c9-4 24-12 31-17 9-7 37-46 52-71-2 22-8 71-15 89-6 15-13 23-17 29l79 45 73-42c1-9 2-28 0-38-1-11-21-55-34-81 18 14 57 44 69 59 11 13 15 24 17 30l74-42v-84c-8-5-24-15-34-19s-58-9-87-10c21-10 66-29 85-31 18-3 29-1 36 1v-87l-70-40-31 19c-9 7-37 46-53 70 3-22 9-71 16-89 6-15 13-24 18-29l-79-45-77 44zm77-65l217 125v250L266 500 49 375V125L266 0z"/>
</svg>

After

Width:  |  Height:  |  Size: 715 B

+13580
View File
File diff suppressed because it is too large Load Diff
+29 -23
View File
@@ -26,12 +26,12 @@
"@semantic-release/npm": "^7.0.0",
"@semantic-release/release-notes-generator": "^9.0.0",
"aggregate-error": "^3.0.0",
"cosmiconfig": "^6.0.0",
"cosmiconfig": "^7.0.0",
"debug": "^4.0.0",
"env-ci": "^5.0.0",
"execa": "^4.0.0",
"execa": "^5.0.0",
"figures": "^3.0.0",
"find-versions": "^3.0.0",
"find-versions": "^4.0.0",
"get-stream": "^5.0.0",
"git-log-parser": "^1.2.0",
"hook-std": "^2.0.0",
@@ -47,27 +47,27 @@
"semver": "^7.3.2",
"semver-diff": "^3.1.1",
"signale": "^1.2.1",
"yargs": "^15.0.1"
"yargs": "^16.2.0"
},
"devDependencies": {
"ava": "^3.1.0",
"clear-module": "^4.0.0",
"codecov": "^3.0.0",
"delay": "^4.0.0",
"dockerode": "^3.0.0",
"file-url": "^3.0.0",
"fs-extra": "^9.0.0",
"got": "^11.0.0",
"js-yaml": "^3.10.0",
"mockserver-client": "^5.1.1",
"nock": "^12.0.0",
"nyc": "^15.0.0",
"p-retry": "^4.0.0",
"proxyquire": "^2.0.0",
"sinon": "^9.0.0",
"stream-buffers": "^3.0.2",
"tempy": "^0.5.0",
"xo": "^0.29.0"
"ava": "3.13.0",
"clear-module": "4.1.1",
"codecov": "3.8.1",
"delay": "4.4.0",
"dockerode": "3.2.1",
"file-url": "3.0.0",
"fs-extra": "9.0.1",
"got": "11.8.0",
"js-yaml": "3.14.0",
"mockserver-client": "5.11.2",
"nock": "12.0.3",
"nyc": "15.1.0",
"p-retry": "4.2.0",
"proxyquire": "2.1.3",
"sinon": "9.2.1",
"stream-buffers": "3.0.2",
"tempy": "0.5.0",
"xo": "0.29.1"
},
"engines": {
"node": ">=10.18"
@@ -122,7 +122,8 @@
"lint": "xo",
"pretest": "npm run lint",
"semantic-release": "./bin/semantic-release.js",
"test": "nyc ava -v"
"test": "nyc ava -v",
"test:ci": "nyc ava -v"
},
"xo": {
"prettier": true,
@@ -130,5 +131,10 @@
"rules": {
"unicorn/string-content": "off"
}
},
"renovate": {
"extends": [
"github>semantic-release/.github"
]
}
}
+19 -2
View File
@@ -505,10 +505,10 @@ test('Allow to unset properties defined in shareable config with "undefined"', a
test('Throw an Error if one of the shareable config cannot be found', async (t) => {
// Create a git repository, set the current working directory at the root of the repo
const {cwd} = await gitRepo();
const pkhOptions = {extends: ['./shareable1.json', 'non-existing-path']};
const pkgOptions = {extends: ['./shareable1.json', 'non-existing-path']};
const options1 = {analyzeCommits: 'analyzeCommits'};
// Create package.json and shareable.json in repository root
await outputJson(path.resolve(cwd, 'package.json'), {release: pkhOptions});
await outputJson(path.resolve(cwd, 'package.json'), {release: pkgOptions});
await outputJson(path.resolve(cwd, 'shareable1.json'), options1);
await t.throwsAsync(t.context.getConfig({cwd}), {
@@ -516,3 +516,20 @@ test('Throw an Error if one of the shareable config cannot be found', async (t)
code: 'MODULE_NOT_FOUND',
});
});
test('Convert "ci" option to "noCi" when set from extended config', async (t) => {
// Create a git repository, set the current working directory at the root of the repo
const {cwd} = await gitRepo();
const pkgOptions = {extends: './no-ci.json'};
const options = {
ci: false,
};
// Create package.json and shareable.json in repository root
await outputJson(path.resolve(cwd, 'package.json'), {release: pkgOptions});
await outputJson(path.resolve(cwd, 'no-ci.json'), options);
const {options: result} = await t.context.getConfig({cwd});
t.is(result.ci, false);
t.is(result.noCi, true);
});
+5 -1
View File
@@ -25,8 +25,12 @@ const {GIT_NOTE_REF} = require('../../lib/definitions/constants');
*/
async function initGit(withRemote) {
const cwd = tempy.directory();
const args = withRemote ? ['--bare', '--initial-branch=master'] : ['--initial-branch=master'];
await execa('git', ['init', ...(withRemote ? ['--bare'] : [])], {cwd});
await execa('git', ['init', ...args], {cwd}).catch(() => {
const args = withRemote ? ['--bare'] : [];
return execa('git', ['init', ...args], {cwd});
});
const repositoryUrl = fileUrl(cwd);
return {cwd, repositoryUrl};
}
+38 -31
View File
@@ -29,17 +29,20 @@ const npmRegistry = require('./helpers/npm-registry');
const requireNoCache = proxyquire.noPreserveCache();
// Environment variables used with semantic-release cli (similar to what a user would setup)
const {GITHUB_ACTION, GITHUB_TOKEN, ...processEnvWithoutGitHubActionsVariables} = process.env;
const env = {
...processEnvWithoutGitHubActionsVariables,
...npmRegistry.authEnv,
GH_TOKEN: gitbox.gitCredential,
GITHUB_URL: mockServer.url,
TRAVIS: 'true',
CI: 'true',
GH_TOKEN: gitbox.gitCredential,
TRAVIS: 'true',
TRAVIS_BRANCH: 'master',
TRAVIS_PULL_REQUEST: 'false',
GITHUB_API_URL: mockServer.url,
};
// Environment variables used only for the local npm command used to do verification
const testEnv = {
const npmTestEnv = {
...process.env,
...npmRegistry.authEnv,
npm_config_registry: npmRegistry.url,
@@ -74,7 +77,7 @@ test('Release patch, minor and major versions', async (t) => {
release: {branches: ['master', 'next'], success: false, fail: false},
});
// Create a npm-shrinkwrap.json file
await execa('npm', ['shrinkwrap'], {env: testEnv, cwd});
await execa('npm', ['shrinkwrap'], {env: npmTestEnv, cwd, extendEnv: false});
/* No release */
let verifyMock = await mockServer.mock(
@@ -85,7 +88,7 @@ test('Release patch, minor and major versions', async (t) => {
t.log('Commit a chore');
await gitCommits(['chore: Init repository'], {cwd});
t.log('$ semantic-release');
let {stdout, exitCode} = await execa(cli, [], {env, cwd});
let {stdout, exitCode} = await execa(cli, [], {env, cwd, extendEnv: false});
t.regex(stdout, /There are no relevant changes, so no new version is released/);
t.is(exitCode, 0);
@@ -108,7 +111,7 @@ test('Release patch, minor and major versions', async (t) => {
t.log('Commit a feature');
await gitCommits(['feat: Initial commit'], {cwd});
t.log('$ semantic-release');
({stdout, exitCode} = await execa(cli, [], {env, cwd}));
({stdout, exitCode} = await execa(cli, [], {env, cwd, extendEnv: false}));
t.regex(stdout, new RegExp(`Published GitHub release: release-url/${version}`));
t.regex(stdout, new RegExp(`Publishing version ${version} to npm registry`));
t.is(exitCode, 0);
@@ -120,7 +123,7 @@ test('Release patch, minor and major versions', async (t) => {
// Retrieve the published package from the registry and check version and gitHead
let {
'dist-tags': {latest: releasedVersion},
} = await npmView(packageName, testEnv);
} = await npmView(packageName, npmTestEnv);
let head = await gitHead({cwd});
t.is(releasedVersion, version);
t.is(await gitTagHead(`v${version}`, {cwd}), head);
@@ -149,7 +152,7 @@ test('Release patch, minor and major versions', async (t) => {
t.log('Commit a fix');
await gitCommits(['fix: bar'], {cwd});
t.log('$ semantic-release');
({stdout, exitCode} = await execa(cli, [], {env, cwd}));
({stdout, exitCode} = await execa(cli, [], {env, cwd, extendEnv: false}));
t.regex(stdout, new RegExp(`Published GitHub release: release-url/${version}`));
t.regex(stdout, new RegExp(`Publishing version ${version} to npm registry`));
t.is(exitCode, 0);
@@ -161,7 +164,7 @@ test('Release patch, minor and major versions', async (t) => {
// Retrieve the published package from the registry and check version and gitHead
({
'dist-tags': {latest: releasedVersion},
} = await npmView(packageName, testEnv));
} = await npmView(packageName, npmTestEnv));
head = await gitHead({cwd});
t.is(releasedVersion, version);
t.is(await gitTagHead(`v${version}`, {cwd}), head);
@@ -190,7 +193,7 @@ test('Release patch, minor and major versions', async (t) => {
t.log('Commit a feature');
await gitCommits(['feat: baz'], {cwd});
t.log('$ semantic-release');
({stdout, exitCode} = await execa(cli, [], {env, cwd}));
({stdout, exitCode} = await execa(cli, [], {env, cwd, extendEnv: false}));
t.regex(stdout, new RegExp(`Published GitHub release: release-url/${version}`));
t.regex(stdout, new RegExp(`Publishing version ${version} to npm registry`));
t.is(exitCode, 0);
@@ -202,7 +205,7 @@ test('Release patch, minor and major versions', async (t) => {
// Retrieve the published package from the registry and check version and gitHead
({
'dist-tags': {latest: releasedVersion},
} = await npmView(packageName, testEnv));
} = await npmView(packageName, npmTestEnv));
head = await gitHead({cwd});
t.is(releasedVersion, version);
t.is(await gitTagHead(`v${version}`, {cwd}), head);
@@ -233,7 +236,7 @@ test('Release patch, minor and major versions', async (t) => {
await gitPush('origin', 'next', {cwd});
await gitCommits(['feat: foo\n\n BREAKING CHANGE: bar'], {cwd});
t.log('$ semantic-release');
({stdout, exitCode} = await execa(cli, [], {env: {...env, TRAVIS_BRANCH: 'next'}, cwd}));
({stdout, exitCode} = await execa(cli, [], {env: {...env, TRAVIS_BRANCH: 'next'}, cwd, extendEnv: false}));
t.regex(stdout, new RegExp(`Published GitHub release: release-url/${version}`));
t.regex(stdout, new RegExp(`Publishing version ${version} to npm registry`));
t.is(exitCode, 0);
@@ -245,7 +248,7 @@ test('Release patch, minor and major versions', async (t) => {
// Retrieve the published package from the registry and check version and gitHead
({
'dist-tags': {next: releasedVersion},
} = await npmView(packageName, testEnv));
} = await npmView(packageName, npmTestEnv));
head = await gitHead({cwd});
t.is(releasedVersion, version);
t.is(await gitGetNote(`v${version}`, {cwd}), '{"channels":["next"]}');
@@ -283,7 +286,7 @@ test('Release patch, minor and major versions', async (t) => {
await merge('next', {cwd});
await gitPush('origin', 'master', {cwd});
t.log('$ semantic-release');
({stdout, exitCode} = await execa(cli, [], {env, cwd}));
({stdout, exitCode} = await execa(cli, [], {env, cwd, extendEnv: false}));
t.regex(stdout, new RegExp(`Updated GitHub release: release-url/${version}`));
t.regex(stdout, new RegExp(`Adding version ${version} to npm registry on dist-tag latest`));
t.is(exitCode, 0);
@@ -293,7 +296,7 @@ test('Release patch, minor and major versions', async (t) => {
// Retrieve the published package from the registry and check version and gitHead
({
'dist-tags': {latest: releasedVersion},
} = await npmView(packageName, testEnv));
} = await npmView(packageName, npmTestEnv));
t.is(releasedVersion, version);
t.is(await gitGetNote(`v${version}`, {cwd}), '{"channels":["next",null]}');
t.is(await gitTagHead(`v${version}`, {cwd}), await gitTagHead(`v${version}`, {cwd}));
@@ -318,7 +321,7 @@ test('Exit with 1 if a plugin is not found', async (t) => {
release: {analyzeCommits: 'non-existing-path', success: false, fail: false},
});
const {exitCode, stderr} = await t.throwsAsync(execa(cli, [], {env, cwd}));
const {exitCode, stderr} = await t.throwsAsync(execa(cli, [], {env, cwd, extendEnv: false}));
t.is(exitCode, 1);
t.regex(stderr, /Cannot find module/);
});
@@ -336,7 +339,7 @@ test('Exit with 1 if a shareable config is not found', async (t) => {
release: {extends: 'non-existing-path', success: false, fail: false},
});
const {exitCode, stderr} = await t.throwsAsync(execa(cli, [], {env, cwd}));
const {exitCode, stderr} = await t.throwsAsync(execa(cli, [], {env, cwd, extendEnv: false}));
t.is(exitCode, 1);
t.regex(stderr, /Cannot find module/);
});
@@ -357,7 +360,7 @@ test('Exit with 1 if a shareable config reference a not found plugin', async (t)
});
await writeJson(path.resolve(cwd, 'shareable.json'), shareable);
const {exitCode, stderr} = await t.throwsAsync(execa(cli, [], {env, cwd}));
const {exitCode, stderr} = await t.throwsAsync(execa(cli, [], {env, cwd, extendEnv: false}));
t.is(exitCode, 1);
t.regex(stderr, /Cannot find module/);
});
@@ -387,7 +390,7 @@ test('Dry-run', async (t) => {
t.log('Commit a feature');
await gitCommits(['feat: Initial commit'], {cwd});
t.log('$ semantic-release -d');
const {stdout, exitCode} = await execa(cli, ['-d'], {env, cwd});
const {stdout, exitCode} = await execa(cli, ['-d'], {env, cwd, extendEnv: false});
t.regex(stdout, new RegExp(`There is no previous release, the next release version is ${version}`));
t.regex(stdout, new RegExp(`Release note for version ${version}`));
t.regex(stdout, /Initial commit/);
@@ -400,7 +403,6 @@ test('Dry-run', async (t) => {
test('Allow local releases with "noCi" option', async (t) => {
const envNoCi = {...env};
delete envNoCi.TRAVIS;
delete envNoCi.CI;
const packageName = 'test-no-ci';
const owner = 'git';
@@ -435,7 +437,7 @@ test('Allow local releases with "noCi" option', async (t) => {
t.log('Commit a feature');
await gitCommits(['feat: Initial commit'], {cwd});
t.log('$ semantic-release --no-ci');
const {stdout, exitCode} = await execa(cli, ['--no-ci'], {env: envNoCi, cwd});
const {stdout, exitCode} = await execa(cli, ['--no-ci'], {env: envNoCi, cwd, extendEnv: false});
t.regex(stdout, new RegExp(`Published GitHub release: release-url/${version}`));
t.regex(stdout, new RegExp(`Publishing version ${version} to npm registry`));
t.is(exitCode, 0);
@@ -444,7 +446,7 @@ test('Allow local releases with "noCi" option', async (t) => {
t.is((await readJson(path.resolve(cwd, 'package.json'))).version, version);
// Retrieve the published package from the registry and check version and gitHead
const {version: releasedVersion, gitHead: releasedGitHead} = await npmView(packageName, testEnv);
const {version: releasedVersion, gitHead: releasedGitHead} = await npmView(packageName, npmTestEnv);
const head = await gitHead({cwd});
t.is(releasedVersion, version);
@@ -488,7 +490,7 @@ test('Pass options via CLI arguments', async (t) => {
false,
'--debug',
],
{env, cwd}
{env, cwd, extendEnv: false}
);
t.regex(stdout, new RegExp(`Publishing version ${version} to npm registry`));
t.is(exitCode, 0);
@@ -497,7 +499,7 @@ test('Pass options via CLI arguments', async (t) => {
t.is((await readJson(path.resolve(cwd, 'package.json'))).version, version);
// Retrieve the published package from the registry and check version and gitHead
const {version: releasedVersion, gitHead: releasedGitHead} = await npmView(packageName, testEnv);
const {version: releasedVersion, gitHead: releasedGitHead} = await npmView(packageName, npmTestEnv);
const head = await gitHead({cwd});
t.is(releasedVersion, version);
t.is(releasedGitHead, head);
@@ -553,7 +555,7 @@ test('Run via JS API', async (t) => {
t.is((await readJson(path.resolve(cwd, 'package.json'))).version, version);
// Retrieve the published package from the registry and check version and gitHead
const {version: releasedVersion, gitHead: releasedGitHead} = await npmView(packageName, testEnv);
const {version: releasedVersion, gitHead: releasedGitHead} = await npmView(packageName, npmTestEnv);
const head = await gitHead({cwd});
t.is(releasedVersion, version);
t.is(releasedGitHead, head);
@@ -582,7 +584,7 @@ test('Log unexpected errors from plugins and exit with 1', async (t) => {
t.log('Commit a feature');
await gitCommits(['feat: Initial commit'], {cwd});
t.log('$ semantic-release');
const {stderr, exitCode} = await execa(cli, [], {env, cwd, reject: false});
const {stderr, exitCode} = await execa(cli, [], {env, cwd, reject: false, extendEnv: false});
// Verify the type and message are logged
t.regex(stderr, /Error: a/);
// Verify the the stacktrace is logged
@@ -609,7 +611,7 @@ test('Log errors inheriting SemanticReleaseError and exit with 1', async (t) =>
t.log('Commit a feature');
await gitCommits(['feat: Initial commit'], {cwd});
t.log('$ semantic-release');
const {stderr, exitCode} = await execa(cli, [], {env, cwd, reject: false});
const {stderr, exitCode} = await execa(cli, [], {env, cwd, reject: false, extendEnv: false});
// Verify the type and message are logged
t.regex(stderr, /EINHERITED Inherited error/);
t.is(exitCode, 1);
@@ -630,7 +632,7 @@ test('Exit with 1 if missing permission to push to the remote repository', async
const {stderr, exitCode} = await execa(
cli,
['--repository-url', 'http://user:wrong_pass@localhost:2080/git/unauthorized.git'],
{env: {...env, GH_TOKEN: 'user:wrong_pass'}, cwd, reject: false}
{env: {...env, GH_TOKEN: 'user:wrong_pass'}, cwd, reject: false, extendEnv: false}
);
// Verify the type and message are logged
t.regex(stderr, /EGITNOPERMISSION/);
@@ -650,7 +652,12 @@ test('Hide sensitive environment variable values from the logs', async (t) => {
});
t.log('$ semantic-release');
const {stdout, stderr} = await execa(cli, [], {env: {...env, MY_TOKEN: 'secret token'}, cwd, reject: false});
const {stdout, stderr} = await execa(cli, [], {
env: {...env, MY_TOKEN: 'secret token'},
cwd,
reject: false,
extendEnv: false,
});
t.regex(stdout, new RegExp(`Console: Exposing token ${escapeRegExp(SECRET_REPLACEMENT)}`));
t.regex(stdout, new RegExp(`Log: Exposing token ${escapeRegExp(SECRET_REPLACEMENT)}`));
@@ -680,7 +687,7 @@ test('Use the valid git credentials when multiple are provided', async (t) => {
test('Use the repository URL as is if none of the given git credentials are valid', async (t) => {
const {cwd} = await gitbox.createRepo('test-invalid-auth');
const dummyUrl = 'http://toto@localhost:2080/git/test-auth.git';
const dummyUrl = 'http://toto@localhost:2080/git/test-invalid-auth.git';
t.is(
await getAuthUrl({