1
0
mirror of https://github.com/actions/setup-node.git synced 2025-12-18 06:48:57 +08:00

Compare commits

..

2 Commits

Author SHA1 Message Date
aparnajyothi-y
3235b87634 add publish immutable actions (#1281) 2025-04-17 08:56:37 -05:00
gowridurgad
dbe1369d7b v3 - upgrade @actions/cache (#1270)
* actions/cache upgarde

* macos-latest to macos-13

* fix check failures

---------

Co-authored-by: “gowridurgad” <“hgowridurgad@github.com>
2025-04-11 16:22:17 -05:00
87 changed files with 46663 additions and 27495 deletions

View File

@@ -18,10 +18,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [12, 14, 16]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Clean global cache
run: npm cache clean --force
- name: Setup Node
@@ -41,10 +41,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [12, 14, 16]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
@@ -74,10 +74,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [14, 16]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Yarn version
run: yarn --version
- name: Generate yarn file
@@ -106,10 +106,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [12, 14, 16]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Update yarn
run: yarn set version 3.6.4
- name: Yarn version
@@ -143,7 +143,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: prepare sub-projects
run: __tests__/prepare-yarn-subprojects.sh yarn1
@@ -170,7 +170,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: prepare sub-projects
run: __tests__/prepare-yarn-subprojects.sh keepcache keepcache
@@ -197,7 +197,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: prepare sub-projects
run: __tests__/prepare-yarn-subprojects.sh global
@@ -224,7 +224,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: prepare sub-projects
run: /bin/bash __tests__/prepare-yarn-subprojects.sh keepcache

View File

@@ -25,7 +25,7 @@ jobs:
env:
https_proxy: http://squid-proxy:3128
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 14
@@ -41,7 +41,7 @@ jobs:
https_proxy: http://no-such-proxy:3128
no_proxy: api.github.com,github.com,nodejs.org,registry.npmjs.org,*.s3.amazonaws.com,s3.amazonaws.com
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Clear tool cache
run: rm -rf $RUNNER_TOOL_CACHE/*
- name: Setup node 11

View File

@@ -0,0 +1,20 @@
name: 'Publish Immutable Action Version'
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
packages: write
steps:
- name: Checking out
uses: actions/checkout@v4
- name: Publish
id: publish
uses: actions/publish-immutable-action@v0.0.4

View File

@@ -17,10 +17,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [10, 12, 14]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
@@ -34,16 +34,16 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
node-version: ${{ matrix.node-version }}
check-latest: true
- if: runner.os != 'Windows'
- if: runner.os != 'Windows' && runner.os != 'macos'
name: Verify node and npm
run: |
. "$NVM_DIR/nvm.sh"
@@ -56,7 +56,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version:
[
'20-v8-canary',
@@ -64,7 +64,7 @@ jobs:
'20.0.0-v8-canary20221101e50e45c9f8'
]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
@@ -81,11 +81,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version:
[16.0.0-nightly20210420a0261d231c, 17-nightly, 18.0.0-nightly]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
@@ -102,10 +102,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [16.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
@@ -122,10 +122,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [10.15, 12.16.0, 14.2.0, 16.3.0]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:
@@ -139,10 +139,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [10, 12, 14]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup Node and check latest
uses: ./
with:
@@ -157,11 +157,11 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version-file:
[.nvmrc, .tool-versions, .tool-versions-node, package.json]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Remove volta from package.json
shell: bash
run: cat <<< "$(jq 'del(.volta)' ./__tests__/data/package.json)" > ./__tests__/data/package.json
@@ -177,9 +177,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup node from node version file
uses: ./
with:
@@ -192,10 +192,10 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [11, 13]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup Node from dist
uses: ./
with:
@@ -209,9 +209,9 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
# test old versions which didn't have npm and layout different
- name: Setup node 0.12.18 from dist
uses: ./
@@ -224,7 +224,7 @@ jobs:
arch:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup node 14 x86 from dist
uses: ./
with:
@@ -239,7 +239,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
node-version: [current, latest, node]
steps:
- name: Get node version
@@ -248,7 +248,7 @@ jobs:
echo "LATEST_NODE_VERSION=$latestNodeVersion" >> $GITHUB_OUTPUT
id: version
shell: bash
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup Node
uses: ./
with:

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@octokit/rest.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@protobuf-ts/plugin.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/@protobuf-ts/protoc.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/@protobuf-ts/runtime.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/atob-lite.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/btoa-lite.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/cross-spawn.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/end-of-stream.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/form-data-3.0.1.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/is-stream.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/isobject.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/lodash.get.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/lodash.set.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/lodash.uniq.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/macos-release.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/npm-run-path.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/os-name.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/p-finally.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/path-key.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/pump.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/shebang-command.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/shebang-regex.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/signal-exit.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/strip-eof.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/tslib-2.3.1.dep.yml generated Normal file

Binary file not shown.

BIN
.licenses/npm/typescript.dep.yml generated Normal file

Binary file not shown.

Binary file not shown.

BIN
.licenses/npm/windows-release.dep.yml generated Normal file

Binary file not shown.

View File

@@ -83,7 +83,7 @@ See [action.yml](action.yml)
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
@@ -132,7 +132,7 @@ See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` in
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
@@ -145,7 +145,7 @@ steps:
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
@@ -166,7 +166,7 @@ jobs:
node: [ 14, 16, 18 ]
name: Node ${{ matrix.node }} sample
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:

View File

@@ -33,7 +33,7 @@ outputs:
node-version:
description: 'The installed node version.'
runs:
using: 'node20'
using: 'node16'
main: 'dist/setup/index.js'
post: 'dist/cache-save/index.js'
post-if: success()

22682
dist/cache-save/index.js vendored

File diff suppressed because one or more lines are too long

44351
dist/setup/index.js vendored

File diff suppressed because one or more lines are too long

View File

@@ -45,7 +45,7 @@ If `check-latest` is set to `true`, the action first checks if the cached versio
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16'
@@ -63,7 +63,7 @@ See [supported version syntax](https://github.com/actions/setup-node#supported-v
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
@@ -95,7 +95,7 @@ jobs:
runs-on: windows-latest
name: Node sample
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
@@ -116,7 +116,7 @@ jobs:
runs-on: ubuntu-latest
name: Node sample
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20.0.0-v8-canary' # it will install the latest v8 canary release for node 20.0.0
@@ -131,7 +131,7 @@ jobs:
runs-on: ubuntu-latest
name: Node sample
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20-v8-canary' # it will install the latest v8 canary release for node 20
@@ -147,7 +147,7 @@ jobs:
runs-on: ubuntu-latest
name: Node sample
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 'v20.1.1-v8-canary20221103f7e2421e91'
@@ -167,7 +167,7 @@ jobs:
runs-on: ubuntu-latest
name: Node sample
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16-nightly' # it will install the latest nightly release for node 16
@@ -183,7 +183,7 @@ jobs:
runs-on: ubuntu-latest
name: Node sample
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.0.0-nightly' # it will install the latest nightly release for node 16.0.0
@@ -199,7 +199,7 @@ jobs:
runs-on: ubuntu-latest
name: Node sample
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.0.0-nightly20210420a0261d231c'
@@ -217,7 +217,7 @@ jobs:
runs-on: ubuntu-latest
name: Node sample
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.0.0-rc.1'
@@ -234,7 +234,7 @@ The action follows [actions/cache](https://github.com/actions/cache/blob/main/ex
Yarn caching handles both yarn versions: 1 or 2.
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
@@ -253,7 +253,7 @@ steps:
# NOTE: pnpm caching support requires pnpm version >= 6.10.0
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 6.32.9
@@ -272,7 +272,7 @@ steps:
**Using wildcard patterns to cache dependencies**
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
@@ -285,7 +285,7 @@ steps:
**Using a list of file paths to cache dependencies**
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
@@ -322,7 +322,7 @@ jobs:
architecture: x86
name: Node ${{ matrix.node_version }} - ${{ matrix.architecture }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
@@ -335,7 +335,7 @@ jobs:
## Publish to npmjs and GPR with npm
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14.x'
@@ -355,7 +355,7 @@ steps:
## Publish to npmjs and GPR with yarn
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14.x'
@@ -375,7 +375,7 @@ steps:
## Use private packages
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14.x'
@@ -395,7 +395,7 @@ Below you can find a sample "Setup .yarnrc.yml" step, that is going to allow you
```yaml
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14.x'

6946
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "setup-node",
"version": "4.0.0",
"version": "3.4.1",
"private": true,
"description": "setup node action",
"main": "lib/setup-node.js",
@@ -25,21 +25,22 @@
"author": "GitHub",
"license": "MIT",
"dependencies": {
"@actions/cache": "^3.0.4",
"@actions/cache": "^4.0.3",
"@actions/core": "^1.10.0",
"@actions/exec": "^1.1.0",
"@actions/github": "^5.1.1",
"@actions/glob": "^0.4.0",
"@actions/http-client": "^2.1.1",
"@actions/github": "^1.1.0",
"@actions/glob": "^0.2.0",
"@actions/http-client": "^1.0.11",
"@actions/io": "^1.0.2",
"@actions/tool-cache": "^2.0.1",
"semver": "^7.5.4",
"uuid": "^9.0.1"
"@actions/tool-cache": "^1.5.4",
"semver": "^6.3.1",
"uuid": "^9.0.0"
},
"devDependencies": {
"@types/jest": "^29.5.5",
"@types/node": "^20.8.2",
"@types/semver": "^7.5.3",
"@types/jest": "^29.5.6",
"@types/node": "^16.11.25",
"@types/semver": "^6.0.0",
"@types/uuid": "^9.0.3",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@vercel/ncc": "^0.38.0",
@@ -52,6 +53,6 @@
"jest-each": "^29.7.0",
"prettier": "^2.8.4",
"ts-jest": "^29.1.1",
"typescript": "^5.2.2"
"typescript": "^4.2.3"
}
}

View File

@@ -16,12 +16,12 @@ export default abstract class BasePrereleaseNodejs extends BaseDistribution {
const localVersionPaths = tc
.findAllVersions('node', this.nodeInfo.arch)
.filter(i => {
const prerelease = semver.prerelease(i, {});
const prerelease = semver.prerelease(i);
if (!prerelease) {
return false;
}
return prerelease[0].toString().includes(this.distribution);
return prerelease[0].includes(this.distribution);
});
localVersionPaths.sort(semver.rcompare);
const localVersion = this.evaluateVersions(localVersionPaths);

View File

@@ -153,7 +153,7 @@ export default abstract class BaseDistribution {
}
protected validRange(versionSpec: string) {
let options: semver.RangeOptions | undefined;
let options: semver.Options | undefined;
const c = semver.clean(versionSpec) || '';
const valid = semver.valid(c) ?? versionSpec;