From cd6d7aaa795721167e69c773de4021880cfd34d0 Mon Sep 17 00:00:00 2001 From: Glenn Hinks Date: Wed, 16 Dec 2020 08:52:17 -0500 Subject: [PATCH 1/4] docs: update nodejs template guide to match node versions The node versions that are maintained as part of the LTS (long term support plan) have incremented by 2 in accordance with [LTS Plan](https://nodejs.org/en/about/releases/). The [nodeJS starter templates](https://github.com/actions/starter-workflows/blob/main/ci/node.js.yml) were updated and I am updating these docs to reflect that. Sincere thanks for github actions! --- content/actions/guides/building-and-testing-nodejs.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/actions/guides/building-and-testing-nodejs.md b/content/actions/guides/building-and-testing-nodejs.md index 7cf7d0667ebe..8a2ef88d0dee 100644 --- a/content/actions/guides/building-and-testing-nodejs.md +++ b/content/actions/guides/building-and-testing-nodejs.md @@ -45,7 +45,7 @@ jobs: strategy: matrix: - node-version: [8.x, 10.x, 12.x] + node-version: [10.x, 12.x, 14.x] steps: - uses: actions/checkout@v2 @@ -69,7 +69,7 @@ The easiest way to specify a Node.js version is by using the `setup-node` action The `setup-node` action takes a Node.js version as an input and configures that version on the runner. The `setup-node` action finds a specific version of Node.js from the tools cache on each runner and adds the necessary binaries to `PATH`, which persists for the rest of the job. Using the `setup-node` action is the recommended way of using Node.js with {% data variables.product.prodname_actions %} because it ensures consistent behavior across different runners and different versions of Node.js. If you are using a self-hosted runner, you must install Node.js and add it to `PATH`. -The template includes a matrix strategy that builds and tests your code with three Node.js versions: 8.x, 10.x, and 12.x. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. Each version of Node.js specified in the `node-version` array creates a job that runs the same steps. +The template includes a matrix strategy that builds and tests your code with three Node.js versions: 10.x, 12.x, and 14.x. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. Each version of Node.js specified in the `node-version` array creates a job that runs the same steps. Each job can access the value defined in the matrix `node-version` array using the `matrix` context. The `setup-node` action uses the context as the `node-version` input. The `setup-node` action configures each job with a different Node.js version before building and testing code. For more information about matrix strategies and contexts, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)" and "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)." @@ -77,7 +77,7 @@ Each job can access the value defined in the matrix `node-version` array using t ```yaml strategy: matrix: - node-version: [8.x, 10.x, 12.x] + node-version: [10.x, 12.x, 14.x] steps: - uses: actions/checkout@v2 From 66c0632da708792cf08a2befd7af541dd0feec29 Mon Sep 17 00:00:00 2001 From: Glenn Date: Wed, 13 Jan 2021 09:31:34 -0500 Subject: [PATCH 2/4] Update building-and-testing-nodejs.md Adding updates due to template changes. The github action is now including 10-15, which is 4 versions following the LTS release schedule --- content/actions/guides/building-and-testing-nodejs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/actions/guides/building-and-testing-nodejs.md b/content/actions/guides/building-and-testing-nodejs.md index fc876b34325d..6bf73cd6504f 100644 --- a/content/actions/guides/building-and-testing-nodejs.md +++ b/content/actions/guides/building-and-testing-nodejs.md @@ -70,7 +70,7 @@ The easiest way to specify a Node.js version is by using the `setup-node` action The `setup-node` action takes a Node.js version as an input and configures that version on the runner. The `setup-node` action finds a specific version of Node.js from the tools cache on each runner and adds the necessary binaries to `PATH`, which persists for the rest of the job. Using the `setup-node` action is the recommended way of using Node.js with {% data variables.product.prodname_actions %} because it ensures consistent behavior across different runners and different versions of Node.js. If you are using a self-hosted runner, you must install Node.js and add it to `PATH`. -The template includes a matrix strategy that builds and tests your code with three Node.js versions: 10.x, 12.x, and 14.x. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. Each version of Node.js specified in the `node-version` array creates a job that runs the same steps. +The template includes a matrix strategy that builds and tests your code with four Node.js versions: 10.x, 12.x, 14.x & 15.x. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. Each version of Node.js specified in the `node-version` array creates a job that runs the same steps. Each job can access the value defined in the matrix `node-version` array using the `matrix` context. The `setup-node` action uses the context as the `node-version` input. The `setup-node` action configures each job with a different Node.js version before building and testing code. For more information about matrix strategies and contexts, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)" and "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)." @@ -78,7 +78,7 @@ Each job can access the value defined in the matrix `node-version` array using t ```yaml strategy: matrix: - node-version: [10.x, 12.x, 14.x] + node-version: [10.x, 12.x, 14.x, 15.x] steps: - uses: actions/checkout@v2 From 9aebacd7877bedacb3c8eed97b9dc976d08f5199 Mon Sep 17 00:00:00 2001 From: shati-patel Date: Thu, 14 Jan 2021 09:09:37 +0000 Subject: [PATCH 3/4] Remove old "env" syntax and update example --- .../guides/building-and-testing-nodejs.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/content/actions/guides/building-and-testing-nodejs.md b/content/actions/guides/building-and-testing-nodejs.md index 6bf73cd6504f..8ee11c025caa 100644 --- a/content/actions/guides/building-and-testing-nodejs.md +++ b/content/actions/guides/building-and-testing-nodejs.md @@ -37,7 +37,11 @@ To get started quickly, add the template to the `.github/workflows` directory of ```yaml{:copy} name: Node.js CI -on: [push] +on: + push: + branches: [ $default-branch ] + pull_request: + branches: [ $default-branch ] jobs: build: @@ -46,7 +50,7 @@ jobs: strategy: matrix: - node-version: [10.x, 12.x, 14.x] + node-version: [10.x, 12.x, 14.x, 15.x] steps: - uses: actions/checkout@v2 @@ -54,11 +58,9 @@ jobs: uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} - - run: npm install + - run: npm ci - run: npm run build --if-present - run: npm test - env: - CI: true ``` {% endraw %} @@ -70,7 +72,7 @@ The easiest way to specify a Node.js version is by using the `setup-node` action The `setup-node` action takes a Node.js version as an input and configures that version on the runner. The `setup-node` action finds a specific version of Node.js from the tools cache on each runner and adds the necessary binaries to `PATH`, which persists for the rest of the job. Using the `setup-node` action is the recommended way of using Node.js with {% data variables.product.prodname_actions %} because it ensures consistent behavior across different runners and different versions of Node.js. If you are using a self-hosted runner, you must install Node.js and add it to `PATH`. -The template includes a matrix strategy that builds and tests your code with four Node.js versions: 10.x, 12.x, 14.x & 15.x. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. Each version of Node.js specified in the `node-version` array creates a job that runs the same steps. +The template includes a matrix strategy that builds and tests your code with four Node.js versions: 10.x, 12.x, 14.x, and 15.x. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. Each version of Node.js specified in the `node-version` array creates a job that runs the same steps. Each job can access the value defined in the matrix `node-version` array using the `matrix` context. The `setup-node` action uses the context as the `node-version` input. The `setup-node` action configures each job with a different Node.js version before building and testing code. For more information about matrix strategies and contexts, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)" and "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)." @@ -119,8 +121,6 @@ jobs: - run: npm install - run: npm run build --if-present - run: npm test - env: - CI: true ``` {% endraw %} From 8c463ee57f7b4af08f923e40c4eccc38cc44f525 Mon Sep 17 00:00:00 2001 From: shati-patel Date: Thu, 14 Jan 2021 09:15:29 +0000 Subject: [PATCH 4/4] Change "install" to "ci" (from template) --- content/actions/guides/building-and-testing-nodejs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/actions/guides/building-and-testing-nodejs.md b/content/actions/guides/building-and-testing-nodejs.md index 8ee11c025caa..6fa457742b95 100644 --- a/content/actions/guides/building-and-testing-nodejs.md +++ b/content/actions/guides/building-and-testing-nodejs.md @@ -118,7 +118,7 @@ jobs: uses: actions/setup-node@v1 with: node-version: '12.x' - - run: npm install + - run: npm ci - run: npm run build --if-present - run: npm test ```