docs(node-version): consolidated and clarified the details about the required node version (#2170)

This commit is contained in:
Matt Travi
2021-10-24 02:27:16 -05:00
committed by GitHub
parent 1e54e9e79a
commit 0d0e0a1d8f
10 changed files with 56 additions and 58 deletions
+7 -14
View File
@@ -10,11 +10,14 @@ Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with
### `.circleci/config.yml` configuration for multiple Node jobs
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.
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.
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`.
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.
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 run against the latest LTS version of node, only after `node/test` has successfully tested against v14 and v16.
```yaml
version: 2.1
@@ -25,6 +28,8 @@ jobs:
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
@@ -44,15 +49,3 @@ workflows:
requires:
- node/test
```
### `package.json` configuration for multiple Node jobs
A `package.json` is required only for [local](../usage/installation.md#local-installation) **semantic-release** installation.
```json
{
"devDependencies": {
"semantic-release": "^18.0.0"
}
}
```
+2 -2
View File
@@ -10,11 +10,11 @@ In this example a publish type [`NPM_TOKEN`](https://docs.npmjs.com/creating-and
[GitHub Actions](https://github.com/features/actions) support [Workflows](https://help.github.com/en/articles/configuring-workflows), allowing to run tests on multiple Node versions and publish a release only when all test pass.
**Note**: The publish pipeline must run on [Node version >= 14.17](../support/FAQ.md#why-does-semantic-release-require-node-version--1417).
**Note**: The publish pipeline must run on a [Node version that meets our version requirement](../support/node-version.md).
### `.github/workflows/release.yml` configuration for Node projects
The following is a minimal configuration for [`semantic-release`](https://github.com/semantic-release/semantic-release) with a build running on Node 14.17 when a new commit is pushed to a `master` branch.
The following is a minimal configuration for [`semantic-release`](https://github.com/semantic-release/semantic-release) with a build running on the latest LTS version of Node when a new commit is pushed to a `master` branch.
See [Configuring a Workflow](https://help.github.com/en/articles/configuring-a-workflow) for additional configuration options.
```yaml
+2 -2
View File
@@ -10,13 +10,13 @@ The [Authentication](../usage/ci-configuration.md#authentication) environment va
GitLab CI supports [Pipelines](https://docs.gitlab.com/ee/ci/pipelines.html) allowing to test on multiple Node versions and publishing a release only when all test pass.
**Note**: The publish pipeline must run a [Node >= 14.17 version](../support/FAQ.md#why-does-semantic-release-require-node-version--1417).
**Note**: The publish pipeline must run a [Node version that meets our version requirement](../support/node-version.md).
### `.gitlab-ci.yml` configuration for Node projects
This example is a minimal configuration for **semantic-release** with a build running Node 10 and 12. See [GitLab CI - Configuration of your jobs with .gitlab-ci.yml](https://docs.gitlab.com/ee/ci/yaml/README.html) for additional configuration options.
**Note**: The`semantic-release` execution command varies depending if you are using a [local](../usage/installation.md#local-installation) or [global](../usage/installation.md#global-installation) **semantic-release** installation.
**Note**: The`semantic-release` execution command varies depending on whether you are using a [local](../usage/installation.md#local-installation) or [global](../usage/installation.md#global-installation) **semantic-release** installation.
```yaml
# The release pipeline will run only if all jobs in the test pipeline are successful
+7 -7
View File
@@ -10,11 +10,11 @@ Alternatively, the default `NPM_TOKEN` and `GH_TOKEN` can be easily [setup with
### `Jenkinsfile (Declarative Pipeline)` configuration for a Node.js job
**Note**: The publish pipeline must run a [Node >= 14.17 version](../support/FAQ.md#why-does-semantic-release-require-node-version--1417).
**Note**: The publish pipeline must run a Node version that [meets our requirement](../support/node-version.md).
This example is a minimal configuration for **semantic-release** with a build running Node 14.17. See [Jenkins documentation](https://www.jenkins.io/doc/) for additional configuration options.
The`semantic-release` execution command varies depending if you are using a [local](../usage/installation.md#local-installation) or [global](../usage/installation.md#global-installation) **semantic-release** installation.
This example is a minimal configuration for **semantic-release** with a build running a version of Node labelled as "node LTS".
Since versions of Node are manually downloaded and labelled, we recommend keeping the version used for the release steps up-to-date with the latest LTS version.
See the [Jenkins documentation](https://www.jenkins.io/doc/) for additional configuration options.
```yaml
// The release stage in the pipeline will run only if the test stage in the pipeline is successful
@@ -31,11 +31,11 @@ pipeline {
npm install
npm test
'''
}
}
}
stage('Release') {
tools {
nodejs "node 14.17"
nodejs "node LTS"
}
steps {
sh '''
@@ -58,4 +58,4 @@ A `package.json` is required only for [local](../usage/installation.md#local-ins
"semantic-release": "^18.0.0"
}
}
```
```