mirror of
https://github.com/actions/setup-node.git
synced 2026-03-04 06:51:04 +08:00
Compare commits
7 Commits
d0b83b92f5
...
bdb25f34f5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdb25f34f5 | ||
|
|
efcb663fc6 | ||
|
|
bc646a96d4 | ||
|
|
d7e640b154 | ||
|
|
2245dabcd0 | ||
|
|
90a8072ea6 | ||
|
|
951664acf3 |
47
.github/workflows/versions.yml
vendored
47
.github/workflows/versions.yml
vendored
@ -20,7 +20,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||
node-version: [20, 22, 24]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
@ -37,7 +37,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest-large]
|
||||
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
@ -64,7 +64,7 @@ jobs:
|
||||
'20.0.0-v8-canary20221101e50e45c9f8'
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
@ -84,7 +84,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||
node-version: [20-nightly, 25-nightly, 24.0.0-nightly]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
@ -104,7 +104,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||
node-version: [20.0.0-rc.1, 22.14.0-rc.1, 24.0.0-rc.4]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
@ -124,7 +124,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||
node-version: [20.10.0, 22.0.0, 24.9.0]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
@ -141,7 +141,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||
node-version: [20, 22, 24]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Node and check latest
|
||||
uses: ./
|
||||
with:
|
||||
@ -160,7 +160,7 @@ jobs:
|
||||
node-version-file:
|
||||
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup node from node version file
|
||||
uses: ./
|
||||
with:
|
||||
@ -173,9 +173,9 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup node from node version file
|
||||
uses: ./
|
||||
with:
|
||||
@ -183,21 +183,6 @@ jobs:
|
||||
- name: Verify node
|
||||
run: __tests__/verify-node.sh 20
|
||||
|
||||
version-file-dev-engines-array:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-13]
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup node from node version file
|
||||
uses: ./
|
||||
with:
|
||||
node-version-file: '__tests__/data/package-dev-engines-array.json'
|
||||
- name: Verify node
|
||||
run: __tests__/verify-node.sh 20
|
||||
|
||||
version-file-volta:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
@ -205,7 +190,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup node from node version file
|
||||
uses: ./
|
||||
with:
|
||||
@ -220,7 +205,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup node from node version file
|
||||
uses: ./
|
||||
with:
|
||||
@ -236,7 +221,7 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest, macos-latest-large]
|
||||
node-version: [17, 19]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Node from dist
|
||||
uses: ./
|
||||
with:
|
||||
@ -252,7 +237,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest-large]
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
# test old versions which didn't have npm and layout different
|
||||
- name: Setup node 0.12.18 from dist
|
||||
uses: ./
|
||||
@ -265,7 +250,7 @@ jobs:
|
||||
arch:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup node 20 x86 from dist
|
||||
uses: ./
|
||||
with:
|
||||
@ -289,7 +274,7 @@ jobs:
|
||||
echo "LATEST_NODE_VERSION=$latestNodeVersion" >> $GITHUB_OUTPUT
|
||||
id: version
|
||||
shell: bash
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
||||
- name: Setup Node
|
||||
uses: ./
|
||||
with:
|
||||
|
||||
2
dist/setup/index.js
vendored
2
dist/setup/index.js
vendored
@ -81660,7 +81660,7 @@ class BaseDistribution {
|
||||
const dataUrl = `${initialUrl}/index.json`;
|
||||
const headers = {};
|
||||
if (this.nodeInfo.mirrorToken) {
|
||||
headers['Authorization'] = `Bearer ${this.nodeInfo.mirrorToken}`;
|
||||
headers['Authorization'] = this.nodeInfo.mirrorToken;
|
||||
}
|
||||
const response = await this.httpClient.getJson(dataUrl, headers);
|
||||
return response.result || [];
|
||||
|
||||
@ -92,41 +92,25 @@ steps:
|
||||
|
||||
When using the `package.json` input, the action will look in the following fields for a specified Node version:
|
||||
1. It checks `volta.node` first.
|
||||
2. Then it checks `devEngines.runtime`.
|
||||
2. Then it checks `devEngines.runtime` for an entry with `"name": "node"`.
|
||||
3. Then it will look for `engines.node`.
|
||||
4. Otherwise it tries to resolve the file defined by [`volta.extends`](https://docs.volta.sh/advanced/workspaces)
|
||||
and look for `volta.node`, `devEngines.runtime`, or `engines.node` recursively.
|
||||
|
||||
### Example with `devEngines`
|
||||
|
||||
When a runtime engine (`engines.node`) is defined but also a development engine (`devEngines.runtime`) then the `devEngines.runtime` version is used.
|
||||
This example will install a Node version based on the `^20.10` pattern.
|
||||
|
||||
```json
|
||||
{
|
||||
"engines": {
|
||||
"node": "^19"
|
||||
"node": "^22 || ^24"
|
||||
},
|
||||
"devEngines": {
|
||||
"runtime": {
|
||||
"name": "node",
|
||||
"version": "^20.10"
|
||||
"version": "^24.3"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example with volta pinned Node version
|
||||
|
||||
When both `engines.node` and `volta.node` is defined the value in `volta.node` is used.
|
||||
|
||||
```json
|
||||
{
|
||||
"engines": {
|
||||
"node": ">=16.0.0"
|
||||
},
|
||||
"volta": {
|
||||
"node": "16.0.0"
|
||||
"node": "24.11.1"
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -496,7 +480,7 @@ Please refer to the [Ensuring workflow access to your package - Configuring a pa
|
||||
It is possible to use a private mirror hosting Node.js binaries. This mirror must be a full mirror of the official Node.js distribution.
|
||||
The mirror URL can be set using the `mirror` input.
|
||||
It is possible to specify a token to authenticate with the mirror using the `mirror-token` input.
|
||||
The token will be passed as a bearer token in the `Authorization` header.
|
||||
The token will be passed in the `Authorization` header.
|
||||
|
||||
```yaml
|
||||
- uses: actions/setup-node@v6
|
||||
|
||||
@ -103,7 +103,7 @@ export default abstract class BaseDistribution {
|
||||
const headers = {};
|
||||
|
||||
if (this.nodeInfo.mirrorToken) {
|
||||
headers['Authorization'] = `Bearer ${this.nodeInfo.mirrorToken}`;
|
||||
headers['Authorization'] = this.nodeInfo.mirrorToken;
|
||||
}
|
||||
|
||||
const response = await this.httpClient.getJson<INodeVersion[]>(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user