Skip to content

Commit 0ad7583

Browse files
authored
Merge pull request #224 from semantic-release-plus/20210719-upstream
20210719 upstream
2 parents 6be7017 + cc7c4df commit 0ad7583

File tree

9 files changed

+113
-102
lines changed

9 files changed

+113
-102
lines changed

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616
- uses: actions/setup-node@v2
17-
- uses: bahmutov/npm-install@v1
17+
with:
18+
cache: npm
19+
- run: npm ci
1820
- run: npx semantic-release
1921
env:
2022
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@ jobs:
3131
uses: actions/setup-node@v2
3232
with:
3333
node-version: ${{ matrix.node-version }}
34+
cache: npm
3435
- name: Ensure dependencies are compatible with the version of node
3536
run: echo 'engine-strict=true' >> .npmrc
36-
- uses: bahmutov/npm-install@v1
37+
- run: npm ci
3738
- run: npm run test:ci
3839

3940
# separate job to set as required in branch protection,
@@ -44,5 +45,7 @@ jobs:
4445
steps:
4546
- uses: actions/checkout@v2
4647
- uses: actions/setup-node@v2
47-
- uses: bahmutov/npm-install@v1
48+
with:
49+
cache: npm
50+
- run: npm ci
4851
- run: npm run lint

docs/recipes/circleci-workflows.md

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,39 @@ Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with
1010

1111
### `.circleci/config.yml` configuration for multiple Node jobs
1212

13-
This example is a minimal configuration for **semantic-release** with a build running Node 6 and 8. See [CircleCI documentation](https://circleci.com/docs/2.0) for additional configuration options.
13+
This example is a minimal configuration for **semantic-release** with tests running against Node 16 and 14. See [CircleCI documentation](https://circleci.com/docs/2.0) for additional configuration options.
1414

15-
This example create the workflows `test_node_4`, `test_node_6`, `test_node_8` and `release`. The release workflows will [run `semantic-release` only after the all the `test_node_*` are successful](../usage/ci-configuration.md#run-semantic-release-only-after-all-tests-succeeded).
15+
In this example, the [`circleci/node`](https://circleci.com/developer/orbs/orb/circleci/node) orb is imported (Which makes some node operations easier), then a `release` job is defined which will run `semantic-release`.
16+
17+
To run our `release` job, we have created a workflow named `test_and_release` which will run two jobs, `node/test`, which comes from the node orb and will test our application, and our release job. Here, we are actually making use of [matrix jobs](https://circleci.com/blog/circleci-matrix-jobs/) so that our single `node/test` job will actually be executed twice, once for Node version 16, and once for version 14. Finally, we call our release job with a `requires` parameter so that `release` will only run after `node/test` has successfully tested against v14 and v16.
1618

1719
```yaml
18-
version: 2
20+
version: 2.1
21+
orbs:
22+
node: circleci/[email protected]
1923
jobs:
20-
test_node_6:
21-
docker:
22-
- image: circleci/node:6
23-
steps:
24-
# Configure your test steps here (checkout, npm install, cache management, tests etc...)
25-
26-
test_node_8:
27-
docker:
28-
- image: circleci/node:8
29-
steps:
30-
# Configure your test steps here (checkout, npm install, cache management, tests etc...)
31-
3224
release:
33-
docker:
34-
- image: circleci/node:8
25+
executor: node/default
3526
steps:
3627
- checkout
37-
- run: npm install
28+
- node/install-packages # Install and automatically cache packages
3829
# Run optional required steps before releasing
3930
# - run: npm run build-script
4031
- run: npx semantic-release
4132

4233
workflows:
43-
version: 2
4434
test_and_release:
4535
# Run the test jobs first, then the release only when all the test jobs are successful
4636
jobs:
47-
- test_node_6
48-
- test_node_8
37+
- node/test:
38+
matrix:
39+
parameters:
40+
version:
41+
- 16.1.0
42+
- 14.7.0
4943
- release:
5044
requires:
51-
- test_node_6
52-
- test_node_8
45+
- node/test
5346
```
5447
5548
### `package.json` configuration for multiple Node jobs

docs/recipes/maintenance-releases.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ The Git history of the repository is now:
3333

3434
One of our users request a new feature, however they cannot migrate to Node.js 8 or higher due to corporate policies.
3535

36-
If we were to push that feature on `master` and release it, the new version would require Node.js 8 or higher as the release would also contains the commit `feat: drop Node.js 6 support \n\n BREAKING CHANGE: Node.js >= 8 required`.
36+
If we were to push that feature on `master` and release it, the new version would require Node.js 8 or higher as the release would also contain the commit `feat: drop Node.js 6 support \n\n BREAKING CHANGE: Node.js >= 8 required`.
3737

3838
Instead, we create the branch `1.x` from the tag `v1.0.0` with the command `git checkout -b 1.x v1.0.0` and we commit that feature with the message `feat: a feature` to the branch `1.x`. When pushing that commit, **semantic-release** will release the version `1.1.0` on the dist-tag `@release-1.x` so users who can't migrate to Node.js 8 or higher can benefit from it.
3939

@@ -48,7 +48,7 @@ The Git history of the repository is now:
4848

4949
## Releasing a bug fix for version 1.0.x users
5050

51-
Another user currently using version `1.0.0` reports a bug. They cannot migrate to Node.js 8 or higher and they also cannot migrate to `1.1.0` as they do not use the feature developed in `feat: a feature` and their corporate policies require to go through a costly quality insurance process for each `minor` upgrades.
51+
Another user currently using version `1.0.0` reports a bug. They cannot migrate to Node.js 8 or higher and they also cannot migrate to `1.1.0` as they do not use the feature developed in `feat: a feature` and their corporate policies require to go through a costly quality assurance process for each `minor` upgrades.
5252

5353
In order to deliver the bug fix in a `patch` release, we create the branch `1.0.x` from the tag `v1.0.0` with the command `git checkout -b 1.0.x v1.0.0` and we commit that fix with the message `fix: a fix` to the branch `1.0.x`. When pushing that commit, **semantic-release** will release the version `1.0.1` on the dist-tag `@release-1.0.x` so users who can't migrate to `1.1.x` or `2.x` can benefit from it.
5454

docs/usage/plugins.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ A plugin is a npm module that can implement one or more of the following steps:
1616
| `success` | No | Responsible for notifying of a new release. |
1717
| `fail` | No | Responsible for notifying of a failed release. |
1818

19+
Release steps will run in that order. At each step, **semantic-release** will run every plugin in the [`plugins` array](#plugins-declaration-and-execution-order), as long as the plugin implements the step.
20+
1921
**Note:** If no plugin with a `analyzeCommits` step is defined `@semantic-release/commit-analyzer` will be used.
2022

2123
## Plugins installation
@@ -70,6 +72,8 @@ With this configuration **semantic-release** will:
7072
- execute the `prepare` implementation of `@semantic-release/npm` then `@semantic-release/git`
7173
- execute the `publish` implementation of `@semantic-release/npm`
7274

75+
Order is first determined by release steps (such as `verifyConditions``anayzeCommits`). At each release step, plugins are executed in the order in which they are defined.
76+
7377
## Plugin options configuration
7478

7579
A plugin configuration can be specified by wrapping the name and an options object in an array. Options configured this way will be passed only to that specific plugin.

docs/usage/workflow-configuration.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Each branch can be defined either as a string, a [glob](https://github.com/micro
1313

1414
A branch can defined as one of three types:
1515
- [release](#release-branches): to make releases on top of the last version released
16-
- [maintenance](#maintenance-branches): to make release on top of an old release
16+
- [maintenance](#maintenance-branches): to make releases on top of an old release
1717
- [pre-release](#pre-release-branches): to make pre-releases
1818

1919
The type of the branch is automatically determined based on naming convention and/or [properties](#branches-properties).
@@ -25,7 +25,7 @@ The type of the branch is automatically determined based on naming convention an
2525
| `name` | All | **Required.** The Git branch holding the commits to analyze and the code to release. See [name](#name). | - The value itself if defined as a `String` or the matching branches name if defined as a glob. |
2626
| `channel` | All | The distribution channel on which to publish releases from this branch. Set to `false` to force the default distribution channel instead of using the default. See [channel](#channel). | `undefined` for the first release branch, the value of `name` for subsequent ones. |
2727
| `range` | [maintenance](#maintenance-branches) only | **Required unless `name` is formatted like `N.N.x` or `N.x` (`N` is a number).** The range of [semantic versions](https://semver.org) to support on this branch. See [range](#range). | The value of `name`. |
28-
| `prerelease` | [pre-release](#pre-release-branches) only | **Required.** The pre-release detonation to append to [semantic versions](https://semver.org) released from this branch. See [prerelease](#prerelease). | - |
28+
| `prerelease` | [pre-release](#pre-release-branches) only | **Required.** The pre-release denotation to append to [semantic versions](https://semver.org) released from this branch. See [prerelease](#prerelease). | - |
2929

3030
### name
3131

package-lock.json

Lines changed: 79 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"file-url": "3.0.0",
6060
"fs-extra": "10.0.0",
6161
"got": "11.8.2",
62-
"js-yaml": "3.14.1",
62+
"js-yaml": "4.1.0",
6363
"mockserver-client": "5.11.2",
6464
"nock": "13.1.1",
6565
"nyc": "15.1.0",

test/get-config.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ test('Read options from .releaserc.yml', async (t) => {
136136
plugins: false,
137137
};
138138
// Create package.json in repository root
139-
await writeFile(path.resolve(cwd, '.releaserc.yml'), yaml.safeDump(options));
139+
await writeFile(path.resolve(cwd, '.releaserc.yml'), yaml.dump(options));
140140

141141
const {options: result} = await t.context.getConfig({cwd});
142142

0 commit comments

Comments
 (0)