mirror of
https://github.com/actions/setup-node.git
synced 2025-10-06 08:03:33 +00:00
chore: bump version to 6.0.0 and update documentation
This commit is contained in:
parent
8f225c52ce
commit
33371d09d4
22
README.md
22
README.md
@ -12,10 +12,14 @@ This action provides the following functionality for GitHub Actions users:
|
|||||||
- Registering problem matchers for error output
|
- Registering problem matchers for error output
|
||||||
- Configuring authentication for GPR or npm
|
- Configuring authentication for GPR or npm
|
||||||
|
|
||||||
|
## Breaking changes in V6
|
||||||
|
|
||||||
|
- Caching is now automatically enabled for npm projects when the `packageManager` field in `package.json` is set to `npm`. For other package managers, such as Yarn and pnpm, caching is disabled by default and must be configured manually using the `cache` input.
|
||||||
|
|
||||||
## Breaking changes in V5
|
## Breaking changes in V5
|
||||||
|
|
||||||
- Enabled caching for npm dependencies by default when the package manager is detected and no cache input is provided.
|
- Enabled caching by default with package manager detection if no cache input is provided.
|
||||||
> For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching for npm by setting `package-manager-cache: false` when caching is not needed for secure operation.
|
> For workflows with elevated privileges or access to sensitive information, we recommend disabling automatic caching by setting `package-manager-cache: false` when caching is not needed for secure operation.
|
||||||
|
|
||||||
- Upgraded action from node20 to node24.
|
- Upgraded action from node20 to node24.
|
||||||
> Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [See Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
|
> Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release. [See Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
|
||||||
@ -28,7 +32,7 @@ See [action.yml](action.yml)
|
|||||||
|
|
||||||
<!-- start usage -->
|
<!-- start usage -->
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
# Version Spec of the version to use in SemVer notation.
|
# Version Spec of the version to use in SemVer notation.
|
||||||
# It also admits such aliases as lts/*, latest, nightly and canary builds
|
# It also admits such aliases as lts/*, latest, nightly and canary builds
|
||||||
@ -114,7 +118,7 @@ See [action.yml](action.yml)
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 24
|
node-version: 24
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -163,7 +167,7 @@ See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` in
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 24
|
node-version: 24
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
@ -176,7 +180,7 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 24
|
node-version: 24
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
@ -192,7 +196,7 @@ This behavior is controlled by the `package-manager-cache` input, which defaults
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
package-manager-cache: false
|
package-manager-cache: false
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -212,7 +216,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node }}
|
node-version: ${{ matrix.node }}
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -226,7 +230,7 @@ jobs:
|
|||||||
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
|
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GH_DOTCOM_TOKEN }}
|
token: ${{ secrets.GH_DOTCOM_TOKEN }}
|
||||||
node-version: 24
|
node-version: 24
|
||||||
|
12
dist/setup/index.js
vendored
12
dist/setup/index.js
vendored
@ -99844,15 +99844,9 @@ function getNameFromPackageManagerField() {
|
|||||||
const packageJson = JSON.parse(fs_1.default.readFileSync(path.join(process.env.GITHUB_WORKSPACE, 'package.json'), 'utf-8'));
|
const packageJson = JSON.parse(fs_1.default.readFileSync(path.join(process.env.GITHUB_WORKSPACE, 'package.json'), 'utf-8'));
|
||||||
// Check devEngines.packageManager first (object or array)
|
// Check devEngines.packageManager first (object or array)
|
||||||
const devPM = (_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.devEngines) === null || _a === void 0 ? void 0 : _a.packageManager;
|
const devPM = (_a = packageJson === null || packageJson === void 0 ? void 0 : packageJson.devEngines) === null || _a === void 0 ? void 0 : _a.packageManager;
|
||||||
if (devPM) {
|
const devPMArray = devPM ? (Array.isArray(devPM) ? devPM : [devPM]) : [];
|
||||||
if (Array.isArray(devPM)) {
|
for (const obj of devPMArray) {
|
||||||
for (const obj of devPM) {
|
if (typeof (obj === null || obj === void 0 ? void 0 : obj.name) === 'string' && npmRegex.test(obj.name)) {
|
||||||
if (typeof (obj === null || obj === void 0 ? void 0 : obj.name) === 'string' && npmRegex.test(obj.name)) {
|
|
||||||
return 'npm';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (typeof (devPM === null || devPM === void 0 ? void 0 : devPM.name) === 'string' && npmRegex.test(devPM.name)) {
|
|
||||||
return 'npm';
|
return 'npm';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ If `check-latest` is set to `true`, the action first checks if the cached versio
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
check-latest: true
|
check-latest: true
|
||||||
@ -64,7 +64,7 @@ See [supported version syntax](https://github.com/actions/setup-node#supported-v
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version-file: '.nvmrc'
|
node-version-file: '.nvmrc'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -98,7 +98,7 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default
|
architecture: 'x64' # optional, x64 or x86. If not specified, x64 will be used by default
|
||||||
@ -119,7 +119,7 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24.0.0-v8-canary' # it will install the latest v8 canary release for node 24.0.0
|
node-version: '24.0.0-v8-canary' # it will install the latest v8 canary release for node 24.0.0
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -134,7 +134,7 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24-v8-canary' # it will install the latest v8 canary release for node 24
|
node-version: '24-v8-canary' # it will install the latest v8 canary release for node 24
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -150,7 +150,7 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: 'v24.0.0-v8-canary2025030537242e55ac'
|
node-version: 'v24.0.0-v8-canary2025030537242e55ac'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -170,7 +170,7 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24-nightly' # it will install the latest nightly release for node 24
|
node-version: '24-nightly' # it will install the latest nightly release for node 24
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -186,7 +186,7 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24.0.0-nightly' # it will install the latest nightly release for node 24.0.0
|
node-version: '24.0.0-nightly' # it will install the latest nightly release for node 24.0.0
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -202,7 +202,7 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24.0.0-nightly202505066102159fa1'
|
node-version: '24.0.0-nightly202505066102159fa1'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -220,7 +220,7 @@ jobs:
|
|||||||
name: Node sample
|
name: Node sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24.0.0-rc.4'
|
node-version: '24.0.0-rc.4'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@ -238,7 +238,7 @@ Yarn caching handles both Yarn Classic (v1) and Yarn Berry (v2, v3, v4+).
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
@ -260,7 +260,7 @@ steps:
|
|||||||
- uses: pnpm/action-setup@v4
|
- uses: pnpm/action-setup@v4
|
||||||
with:
|
with:
|
||||||
version: 10
|
version: 10
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
@ -276,7 +276,7 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
@ -289,7 +289,7 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24'
|
node-version: '24'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
@ -327,7 +327,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- name: Setup node
|
- name: Setup node
|
||||||
uses: actions/setup-node@v5
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: ${{ matrix.node_version }}
|
node-version: ${{ matrix.node_version }}
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix.architecture }}
|
||||||
@ -339,7 +339,7 @@ jobs:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24.x'
|
node-version: '24.x'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
@ -347,7 +347,7 @@ steps:
|
|||||||
- run: npm publish
|
- run: npm publish
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
registry-url: 'https://npm.pkg.github.com'
|
registry-url: 'https://npm.pkg.github.com'
|
||||||
- run: npm publish
|
- run: npm publish
|
||||||
@ -359,7 +359,7 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24.x'
|
node-version: '24.x'
|
||||||
registry-url: <registry url>
|
registry-url: <registry url>
|
||||||
@ -367,7 +367,7 @@ steps:
|
|||||||
- run: yarn publish
|
- run: yarn publish
|
||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.YARN_TOKEN }}
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
registry-url: 'https://npm.pkg.github.com'
|
registry-url: 'https://npm.pkg.github.com'
|
||||||
- run: yarn publish
|
- run: yarn publish
|
||||||
@ -379,7 +379,7 @@ steps:
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24.x'
|
node-version: '24.x'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
@ -399,7 +399,7 @@ Below you can find a sample "Setup .yarnrc.yml" step, that is going to allow you
|
|||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24.x'
|
node-version: '24.x'
|
||||||
- name: Setup .yarnrc.yml
|
- name: Setup .yarnrc.yml
|
||||||
@ -428,7 +428,7 @@ It is possible to specify a token to authenticate with the mirror using the `mir
|
|||||||
The token will be passed as a bearer token in the `Authorization` header.
|
The token will be passed as a bearer token in the `Authorization` header.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/setup-node@v5
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version: '24.x'
|
node-version: '24.x'
|
||||||
mirror: 'https://nodejs.org/dist'
|
mirror: 'https://nodejs.org/dist'
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-node",
|
"name": "setup-node",
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "setup-node",
|
"name": "setup-node",
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/cache": "^4.0.3",
|
"@actions/cache": "^4.0.3",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "setup-node",
|
"name": "setup-node",
|
||||||
"version": "5.0.0",
|
"version": "6.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "setup node action",
|
"description": "setup node action",
|
||||||
"main": "lib/setup-node.js",
|
"main": "lib/setup-node.js",
|
||||||
|
11
src/main.ts
11
src/main.ts
@ -149,14 +149,9 @@ export function getNameFromPackageManagerField(): string | undefined {
|
|||||||
|
|
||||||
// Check devEngines.packageManager first (object or array)
|
// Check devEngines.packageManager first (object or array)
|
||||||
const devPM = packageJson?.devEngines?.packageManager;
|
const devPM = packageJson?.devEngines?.packageManager;
|
||||||
if (devPM) {
|
const devPMArray = devPM ? (Array.isArray(devPM) ? devPM : [devPM]) : [];
|
||||||
if (Array.isArray(devPM)) {
|
for (const obj of devPMArray) {
|
||||||
for (const obj of devPM) {
|
if (typeof obj?.name === 'string' && npmRegex.test(obj.name)) {
|
||||||
if (typeof obj?.name === 'string' && npmRegex.test(obj.name)) {
|
|
||||||
return 'npm';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (typeof devPM?.name === 'string' && npmRegex.test(devPM.name)) {
|
|
||||||
return 'npm';
|
return 'npm';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user