Use engines.node as source of version data for actions/setup-node action

The actions/setup-node GitHub Actions action is used to set up Node.js in the GitHub Actions runner machine.

The action supports obtaining the Node.js version to set up from the `engines.node` field of the package.json file.

This allows us to define the standardized version of Node.js for use by project contributors in a single place rather
than having to maintain multiple instances of that data.
This commit is contained in:
per1234
2024-08-01 13:14:06 -07:00
parent f6a7bd0dc6
commit 77bb572fdf
11 changed files with 20 additions and 48 deletions
+1 -5
View File
@@ -1,9 +1,5 @@
name: Check Action Metadata
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 20.x
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
@@ -37,7 +33,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
+2 -6
View File
@@ -1,10 +1,6 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-markdown-task.md
name: Check Markdown
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 16.x
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
@@ -48,7 +44,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Initialize markdownlint-cli problem matcher
uses: xt0rted/markdownlint-problem-matcher@v3
@@ -72,7 +68,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
+2 -6
View File
@@ -1,10 +1,6 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-npm-dependencies-task.md
name: Check npm Dependencies
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 20.x
# See: https://docs.github.com/actions/using-workflows/events-that-trigger-workflows
on:
create:
@@ -78,7 +74,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
@@ -128,7 +124,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
+2 -6
View File
@@ -1,10 +1,6 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-npm-task.md
name: Check npm
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 16.x
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
@@ -39,7 +35,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
@@ -60,7 +56,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
+1 -5
View File
@@ -1,10 +1,6 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-prettier-formatting-task.md
name: Check Prettier Formatting
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 20.x
# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows
on:
push:
@@ -213,7 +209,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
+1 -5
View File
@@ -1,9 +1,5 @@
name: Check TypeScript Configuration
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 16.x
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
@@ -45,7 +41,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
+1 -5
View File
@@ -1,9 +1,5 @@
name: Check TypeScript
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 20.x
# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
push:
@@ -51,7 +47,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
+2 -4
View File
@@ -2,8 +2,6 @@
name: Sync Labels
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 16.x
CONFIGURATIONS_FOLDER: .github/label-configuration-files
CONFIGURATIONS_ARTIFACT: label-configuration-files
@@ -38,7 +36,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Download JSON schema for labels configuration file
id: download-schema
@@ -132,7 +130,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Merge label configuration files
run: |
+2 -6
View File
@@ -1,9 +1,5 @@
name: Test TypeScript
env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 20.x
on:
push:
paths:
@@ -54,7 +50,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
@@ -75,7 +71,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
node-version-file: package.json
- name: Install Task
uses: arduino/setup-task@v2
+3
View File
@@ -37,6 +37,9 @@
"strip-json-comments-cli": "^3.0.0",
"ts-jest": "^28.0.8",
"typescript": "^5.5.4"
},
"engines": {
"node": "20.x"
}
},
"node_modules/@aashutoshrathi/word-wrap": {
+3
View File
@@ -46,5 +46,8 @@
"strip-json-comments-cli": "^3.0.0",
"ts-jest": "^28.0.8",
"typescript": "^5.5.4"
},
"engines": {
"node": "20.x"
}
}