mirror of
				https://gitea.com/actions/setup-node.git
				synced 2025-10-29 07:47:20 +00:00 
			
		
		
		
	Compare commits
	
		
			12 Commits
		
	
	
		
			v4.0.0
			...
			Node-Test-
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | eff380dfbc | ||
| ![dependabot[bot]](/assets/img/avatar_default.png)  | c2ac33f2c6 | ||
|   | 25b062c917 | ||
|   | 60edb5dd54 | ||
|   | d86ebcd40b | ||
|   | b39b52d121 | ||
|   | 7247617371 | ||
|   | f3ec4ca66f | ||
|   | ec97f37504 | ||
|   | 5ef044f9d0 | ||
|   | c45882a6ea | ||
|   | ee36e8b5c0 | 
							
								
								
									
										2
									
								
								.github/workflows/basic-validation.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/basic-validation.yml
									
									
									
									
										vendored
									
									
								
							| @@ -15,3 +15,5 @@ jobs: | |||||||
|   call-basic-validation: |   call-basic-validation: | ||||||
|     name: Basic validation |     name: Basic validation | ||||||
|     uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main |     uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main | ||||||
|  |     with: | ||||||
|  |       node-version: '20.x' | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/check-dist.yml
									
									
									
									
										vendored
									
									
								
							| @@ -15,3 +15,5 @@ jobs: | |||||||
|   call-check-dist: |   call-check-dist: | ||||||
|     name: Check dist/ |     name: Check dist/ | ||||||
|     uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main |     uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main | ||||||
|  |     with: | ||||||
|  |       node-version: '20.x' | ||||||
|   | |||||||
							
								
								
									
										18
									
								
								.github/workflows/e2e-cache.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								.github/workflows/e2e-cache.yml
									
									
									
									
										vendored
									
									
								
							| @@ -19,7 +19,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: [12, 14, 16] |         node-version: [18, 20, 22] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Clean global cache |       - name: Clean global cache | ||||||
| @@ -42,7 +42,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: [12, 14, 16] |         node-version: [18, 20, 22] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Install pnpm |       - name: Install pnpm | ||||||
| @@ -75,7 +75,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: [14, 16] |         node-version: [18, 20] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Yarn version |       - name: Yarn version | ||||||
| @@ -93,7 +93,7 @@ jobs: | |||||||
|           node-version: ${{ matrix.node-version }} |           node-version: ${{ matrix.node-version }} | ||||||
|           cache: 'yarn' |           cache: 'yarn' | ||||||
|       - name: Install dependencies |       - name: Install dependencies | ||||||
|         run: yarn install |         run: yarn install --ignore-engines | ||||||
|       - name: Verify node and yarn |       - name: Verify node and yarn | ||||||
|         run: __tests__/verify-node.sh "${{ matrix.node-version }}" |         run: __tests__/verify-node.sh "${{ matrix.node-version }}" | ||||||
|         shell: bash |         shell: bash | ||||||
| @@ -107,7 +107,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: [12, 14, 16] |         node-version: [18, 20, 22] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Update yarn |       - name: Update yarn | ||||||
| @@ -139,7 +139,7 @@ jobs: | |||||||
|     name: Test yarn subprojects |     name: Test yarn subprojects | ||||||
|     strategy: |     strategy: | ||||||
|       matrix: |       matrix: | ||||||
|         node-version: [12, 14, 16] |         node-version: [18, 20, 22] | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
| @@ -166,7 +166,7 @@ jobs: | |||||||
|     name: Test yarn subprojects all locally managed |     name: Test yarn subprojects all locally managed | ||||||
|     strategy: |     strategy: | ||||||
|       matrix: |       matrix: | ||||||
|         node-version: [12, 14, 16] |         node-version: [18, 20, 22] | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
| @@ -193,7 +193,7 @@ jobs: | |||||||
|     name: Test yarn subprojects some locally managed |     name: Test yarn subprojects some locally managed | ||||||
|     strategy: |     strategy: | ||||||
|       matrix: |       matrix: | ||||||
|         node-version: [12, 14, 16] |         node-version: [18, 20, 22] | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
| @@ -220,7 +220,7 @@ jobs: | |||||||
|     name: Test yarn subprojects managed by git |     name: Test yarn subprojects managed by git | ||||||
|     strategy: |     strategy: | ||||||
|       matrix: |       matrix: | ||||||
|         node-version: [12, 14, 16] |         node-version: [18, 20, 22] | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|  |  | ||||||
|     steps: |     steps: | ||||||
|   | |||||||
							
								
								
									
										46
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										46
									
								
								.github/workflows/versions.yml
									
									
									
									
										vendored
									
									
								
							| @@ -18,7 +18,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: [10, 12, 14] |         node-version: [18, 20, 22] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Setup Node |       - name: Setup Node | ||||||
| @@ -34,7 +34,7 @@ jobs: | |||||||
|     strategy: |     strategy: | ||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       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] |         node-version: [lts/dubnium, lts/erbium, lts/fermium, lts/*, lts/-1] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
| @@ -43,7 +43,7 @@ jobs: | |||||||
|         with: |         with: | ||||||
|           node-version: ${{ matrix.node-version }} |           node-version: ${{ matrix.node-version }} | ||||||
|           check-latest: true |           check-latest: true | ||||||
|       - if: runner.os != 'Windows' |       - if: runner.os != 'Windows' && runner.os != 'macOS' | ||||||
|         name: Verify node and npm |         name: Verify node and npm | ||||||
|         run: | |         run: | | ||||||
|           . "$NVM_DIR/nvm.sh" |           . "$NVM_DIR/nvm.sh" | ||||||
| @@ -83,7 +83,7 @@ jobs: | |||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: |         node-version: | ||||||
|           [16.0.0-nightly20210420a0261d231c, 17-nightly, 18.0.0-nightly] |           [20.11.0-nightly202312211a0be537da, 21-nightly, 18.0.0-nightly] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Setup Node |       - name: Setup Node | ||||||
| @@ -103,7 +103,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: [16.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0] |         node-version: [20.0.0-rc.1, 18.0.0-rc.2, 19.0.0-rc.0] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Setup Node |       - name: Setup Node | ||||||
| @@ -123,7 +123,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: [10.15, 12.16.0, 14.2.0, 16.3.0] |         node-version: [18.20.0, 20.10.0, 22.0.0] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Setup Node |       - name: Setup Node | ||||||
| @@ -140,7 +140,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: [10, 12, 14] |         node-version: [18, 20, 22] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Setup Node and check latest |       - name: Setup Node and check latest | ||||||
| @@ -162,15 +162,12 @@ jobs: | |||||||
|           [.nvmrc, .tool-versions, .tool-versions-node, package.json] |           [.nvmrc, .tool-versions, .tool-versions-node, package.json] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Remove volta from package.json |  | ||||||
|         shell: bash |  | ||||||
|         run: cat <<< "$(jq 'del(.volta)' ./__tests__/data/package.json)" > ./__tests__/data/package.json |  | ||||||
|       - name: Setup node from node version file |       - name: Setup node from node version file | ||||||
|         uses: ./ |         uses: ./ | ||||||
|         with: |         with: | ||||||
|           node-version-file: '__tests__/data/${{ matrix.node-version-file }}' |           node-version-file: '__tests__/data/${{ matrix.node-version-file }}' | ||||||
|       - name: Verify node |       - name: Verify node | ||||||
|         run: __tests__/verify-node.sh 14 |         run: __tests__/verify-node.sh 20 | ||||||
|  |  | ||||||
|   version-file-volta: |   version-file-volta: | ||||||
|     runs-on: ${{ matrix.os }} |     runs-on: ${{ matrix.os }} | ||||||
| @@ -183,9 +180,24 @@ jobs: | |||||||
|       - name: Setup node from node version file |       - name: Setup node from node version file | ||||||
|         uses: ./ |         uses: ./ | ||||||
|         with: |         with: | ||||||
|           node-version-file: '__tests__/data/package.json' |           node-version-file: '__tests__/data/package-volta.json' | ||||||
|       - name: Verify node |       - name: Verify node | ||||||
|         run: __tests__/verify-node.sh 16 |         run: __tests__/verify-node.sh 20 | ||||||
|  |  | ||||||
|  |   version-file-volta-extends: | ||||||
|  |     runs-on: ${{ matrix.os }} | ||||||
|  |     strategy: | ||||||
|  |       fail-fast: false | ||||||
|  |       matrix: | ||||||
|  |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@v4 | ||||||
|  |       - name: Setup node from node version file | ||||||
|  |         uses: ./ | ||||||
|  |         with: | ||||||
|  |           node-version-file: '__tests__/data/package-volta-extends.json' | ||||||
|  |       - name: Verify node | ||||||
|  |         run: __tests__/verify-node.sh 20 | ||||||
|  |  | ||||||
|   node-dist: |   node-dist: | ||||||
|     runs-on: ${{ matrix.os }} |     runs-on: ${{ matrix.os }} | ||||||
| @@ -193,7 +205,7 @@ jobs: | |||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-latest] | ||||||
|         node-version: [11, 13] |         node-version: [17, 19] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Setup Node from dist |       - name: Setup Node from dist | ||||||
| @@ -209,7 +221,7 @@ jobs: | |||||||
|     strategy: |     strategy: | ||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       matrix: | ||||||
|         os: [ubuntu-latest, windows-latest, macos-latest] |         os: [ubuntu-latest, windows-latest, macos-13] | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       # test old versions which didn't have npm and layout different |       # test old versions which didn't have npm and layout different | ||||||
| @@ -225,10 +237,10 @@ jobs: | |||||||
|     runs-on: windows-latest |     runs-on: windows-latest | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Setup node 14 x86 from dist |       - name: Setup node 20 x86 from dist | ||||||
|         uses: ./ |         uses: ./ | ||||||
|         with: |         with: | ||||||
|           node-version: '14' |           node-version: '20' | ||||||
|           architecture: 'x86' |           architecture: 'x86' | ||||||
|       - name: Verify node |       - name: Verify node | ||||||
|         run: __tests__/verify-arch.sh "ia32" |         run: __tests__/verify-arch.sh "ia32" | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@actions/cache.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: "@actions/cache" | name: "@actions/cache" | ||||||
| version: 3.2.2 | version: 3.2.4 | ||||||
| type: npm | type: npm | ||||||
| summary: Actions cache lib | summary: Actions cache lib | ||||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/cache | homepage: https://github.com/actions/toolkit/tree/main/packages/cache | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.licenses/npm/@actions/http-client.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@actions/http-client.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: "@actions/http-client" | name: "@actions/http-client" | ||||||
| version: 2.2.0 | version: 2.2.1 | ||||||
| type: npm | type: npm | ||||||
| summary: Actions Http Client | summary: Actions Http Client | ||||||
| homepage: https://github.com/actions/toolkit/tree/main/packages/http-client | homepage: https://github.com/actions/toolkit/tree/main/packages/http-client | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.licenses/npm/@types/node.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/@types/node.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: "@types/node" | name: "@types/node" | ||||||
| version: 20.8.7 | version: 20.11.25 | ||||||
| type: npm | type: npm | ||||||
| summary: TypeScript definitions for node | summary: TypeScript definitions for node | ||||||
| homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node | homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: semver | name: semver | ||||||
| version: 7.5.4 | version: 7.6.0 | ||||||
| type: npm | type: npm | ||||||
| summary: The semantic version parser used by npm. | summary: The semantic version parser used by npm. | ||||||
| homepage: | homepage: | ||||||
							
								
								
									
										2
									
								
								.licenses/npm/undici-types.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/undici-types.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: undici-types | name: undici-types | ||||||
| version: 5.25.3 | version: 5.26.5 | ||||||
| type: npm | type: npm | ||||||
| summary: A stand-alone types package for Undici | summary: A stand-alone types package for Undici | ||||||
| homepage: https://undici.nodejs.org | homepage: https://undici.nodejs.org | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								.licenses/npm/undici.dep.yml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.licenses/npm/undici.dep.yml
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| --- | --- | ||||||
| name: undici | name: undici | ||||||
| version: 5.26.5 | version: 5.28.3 | ||||||
| type: npm | type: npm | ||||||
| summary: An HTTP/1.1 client, written from scratch for Node.js | summary: An HTTP/1.1 client, written from scratch for Node.js | ||||||
| homepage: https://undici.nodejs.org | homepage: https://undici.nodejs.org | ||||||
|   | |||||||
							
								
								
									
										24
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								README.md
									
									
									
									
									
								
							| @@ -18,14 +18,14 @@ See [action.yml](action.yml) | |||||||
|  |  | ||||||
| <!-- start usage --> | <!-- start usage --> | ||||||
| ```yaml | ```yaml | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     # Version Spec of the version to use in SemVer notation. |     # Version Spec of the version to use in SemVer notation. | ||||||
|     # It also emits such aliases as lts, latest, nightly and canary builds |     # It also emits such aliases as lts, latest, nightly and canary builds | ||||||
|     # Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node |     # Examples: 12.x, 10.15.1, >=10.15.0, lts/Hydrogen, 16-nightly, latest, node | ||||||
|     node-version: '' |     node-version: '' | ||||||
|  |  | ||||||
|     # File containing the version Spec of the version to use.  Examples: .nvmrc, .node-version, .tool-versions. |     # File containing the version Spec of the version to use.  Examples: package.json, .nvmrc, .node-version, .tool-versions. | ||||||
|     # If node-version and node-version-file are both provided the action will use version from node-version.  |     # If node-version and node-version-file are both provided the action will use version from node-version.  | ||||||
|     node-version-file: '' |     node-version-file: '' | ||||||
|  |  | ||||||
| @@ -84,7 +84,7 @@ See [action.yml](action.yml) | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: 18 |     node-version: 18 | ||||||
| - run: npm ci | - run: npm ci | ||||||
| @@ -103,12 +103,12 @@ The `node-version` input supports the Semantic Versioning Specification, for mor | |||||||
|  |  | ||||||
| Examples: | Examples: | ||||||
|  |  | ||||||
|  - Major versions: `14`, `16`, `18` |  - Major versions: `18`, `20` | ||||||
|  - More specific versions: `10.15`, `16.15.1` , `18.4.0` |  - More specific versions: `10.15`, `16.15.1` , `18.4.0` | ||||||
|  - NVM LTS syntax: `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n` |  - NVM LTS syntax: `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n` | ||||||
|  - Latest release: `*` or `latest`/`current`/`node` |  - Latest release: `*` or `latest`/`current`/`node` | ||||||
|  |  | ||||||
| **Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input. | **Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input. | ||||||
|  |  | ||||||
| `current`/`latest`/`node` always resolve to the latest [dist version](https://nodejs.org/dist/index.json). | `current`/`latest`/`node` always resolve to the latest [dist version](https://nodejs.org/dist/index.json). | ||||||
| That version is then downloaded from actions/node-versions if possible, or directly from Node.js if not. | That version is then downloaded from actions/node-versions if possible, or directly from Node.js if not. | ||||||
| @@ -133,9 +133,9 @@ See the examples of using cache for `yarn`/`pnpm` and `cache-dependency-path` in | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: 16 |     node-version: 20 | ||||||
|     cache: 'npm' |     cache: 'npm' | ||||||
| - run: npm ci | - run: npm ci | ||||||
| - run: npm test | - run: npm test | ||||||
| @@ -146,9 +146,9 @@ steps: | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: 16 |     node-version: 20 | ||||||
|     cache: 'npm' |     cache: 'npm' | ||||||
|     cache-dependency-path: subdir/package-lock.json |     cache-dependency-path: subdir/package-lock.json | ||||||
| - run: npm ci | - run: npm ci | ||||||
| @@ -168,7 +168,7 @@ jobs: | |||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Setup node |       - name: Setup node | ||||||
|         uses: actions/setup-node@v3 |         uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: ${{ matrix.node }} |           node-version: ${{ matrix.node }} | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
| @@ -182,10 +182,10 @@ 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@v3 | uses: actions/setup-node@v4 | ||||||
| with: | with: | ||||||
|   token: ${{ secrets.GH_DOTCOM_TOKEN }} |   token: ${{ secrets.GH_DOTCOM_TOKEN }} | ||||||
|   node-version: 16 |   node-version: 20 | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| If the runner is not able to access github.com, any Nodejs versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information. | If the runner is not able to access github.com, any Nodejs versions requested during a workflow run must come from the runner's tool cache. See "[Setting up the tool cache on self-hosted runners without internet access](https://docs.github.com/en/enterprise-server@3.2/admin/github-actions/managing-access-to-actions-from-githubcom/setting-up-the-tool-cache-on-self-hosted-runners-without-internet-access)" for more information. | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| v14 | v20 | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| nodejs 14.0.0 | nodejs 20.0.0 | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| node 14.0.0 | node 20.0.0 | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								__tests__/data/package-volta-extends.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								__tests__/data/package-volta-extends.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,5 @@ | |||||||
|  | { | ||||||
|  |   "volta": { | ||||||
|  |     "extends": "./package-volta.json" | ||||||
|  |   } | ||||||
|  | } | ||||||
							
								
								
									
										8
									
								
								__tests__/data/package-volta.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								__tests__/data/package-volta.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | |||||||
|  | { | ||||||
|  |   "engines": { | ||||||
|  |     "node": "^14.0.0" | ||||||
|  |   }, | ||||||
|  |   "volta": { | ||||||
|  |     "node": "20.0.0" | ||||||
|  |   } | ||||||
|  | } | ||||||
| @@ -1,8 +1,5 @@ | |||||||
| { | { | ||||||
|   "engines": { |   "engines": { | ||||||
|     "node": "^14.0.0" |     "node": "^20.0.0" | ||||||
|   }, |  | ||||||
|   "volta": { |  | ||||||
|     "node": "16.0.0" |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ import * as core from '@actions/core'; | |||||||
| import * as exec from '@actions/exec'; | import * as exec from '@actions/exec'; | ||||||
| import * as tc from '@actions/tool-cache'; | import * as tc from '@actions/tool-cache'; | ||||||
| import * as cache from '@actions/cache'; | import * as cache from '@actions/cache'; | ||||||
|  | import * as io from '@actions/io'; | ||||||
|  |  | ||||||
| import fs from 'fs'; | import fs from 'fs'; | ||||||
| import path from 'path'; | import path from 'path'; | ||||||
| @@ -24,11 +25,13 @@ describe('main tests', () => { | |||||||
|   let startGroupSpy: jest.SpyInstance; |   let startGroupSpy: jest.SpyInstance; | ||||||
|   let endGroupSpy: jest.SpyInstance; |   let endGroupSpy: jest.SpyInstance; | ||||||
|  |  | ||||||
|  |   let whichSpy: jest.SpyInstance; | ||||||
|  |  | ||||||
|   let existsSpy: jest.SpyInstance; |   let existsSpy: jest.SpyInstance; | ||||||
|  |  | ||||||
|   let getExecOutputSpy: jest.SpyInstance; |   let getExecOutputSpy: jest.SpyInstance; | ||||||
|  |  | ||||||
|   let parseNodeVersionSpy: jest.SpyInstance; |   let getNodeVersionFromFileSpy: jest.SpyInstance; | ||||||
|   let cnSpy: jest.SpyInstance; |   let cnSpy: jest.SpyInstance; | ||||||
|   let findSpy: jest.SpyInstance; |   let findSpy: jest.SpyInstance; | ||||||
|   let isCacheActionAvailable: jest.SpyInstance; |   let isCacheActionAvailable: jest.SpyInstance; | ||||||
| @@ -41,6 +44,7 @@ describe('main tests', () => { | |||||||
|     // node |     // node | ||||||
|     os = {}; |     os = {}; | ||||||
|     console.log('::stop-commands::stoptoken'); |     console.log('::stop-commands::stoptoken'); | ||||||
|  |     process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); | ||||||
|     process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out |     process.env['GITHUB_PATH'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out | ||||||
|     process.env['GITHUB_OUTPUT'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out |     process.env['GITHUB_OUTPUT'] = ''; // Stub out ENV file functionality so we can verify it writes to standard out | ||||||
|     infoSpy = jest.spyOn(core, 'info'); |     infoSpy = jest.spyOn(core, 'info'); | ||||||
| @@ -56,18 +60,18 @@ describe('main tests', () => { | |||||||
|     inSpy = jest.spyOn(core, 'getInput'); |     inSpy = jest.spyOn(core, 'getInput'); | ||||||
|     inSpy.mockImplementation(name => inputs[name]); |     inSpy.mockImplementation(name => inputs[name]); | ||||||
|  |  | ||||||
|  |     whichSpy = jest.spyOn(io, 'which'); | ||||||
|  |  | ||||||
|     getExecOutputSpy = jest.spyOn(exec, 'getExecOutput'); |     getExecOutputSpy = jest.spyOn(exec, 'getExecOutput'); | ||||||
|  |  | ||||||
|     findSpy = jest.spyOn(tc, 'find'); |     findSpy = jest.spyOn(tc, 'find'); | ||||||
|  |  | ||||||
|     isCacheActionAvailable = jest.spyOn(cache, 'isFeatureAvailable'); |     isCacheActionAvailable = jest.spyOn(cache, 'isFeatureAvailable'); | ||||||
|  |  | ||||||
|     existsSpy = jest.spyOn(fs, 'existsSync'); |  | ||||||
|  |  | ||||||
|     cnSpy = jest.spyOn(process.stdout, 'write'); |     cnSpy = jest.spyOn(process.stdout, 'write'); | ||||||
|     cnSpy.mockImplementation(line => { |     cnSpy.mockImplementation(line => { | ||||||
|       // uncomment to debug |       // uncomment to debug | ||||||
|       // process.stderr.write('write:' + line + '\n'); |       process.stderr.write('write:' + line + '\n'); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     setupNodeJsSpy = jest.spyOn(OfficialBuilds.prototype, 'setupNodeJs'); |     setupNodeJsSpy = jest.spyOn(OfficialBuilds.prototype, 'setupNodeJs'); | ||||||
| @@ -85,7 +89,7 @@ describe('main tests', () => { | |||||||
|     jest.restoreAllMocks(); |     jest.restoreAllMocks(); | ||||||
|   }, 100000); |   }, 100000); | ||||||
|  |  | ||||||
|   describe('parseNodeVersionFile', () => { |   describe('getNodeVersionFromFile', () => { | ||||||
|     each` |     each` | ||||||
|       contents                                     | expected |       contents                                     | expected | ||||||
|       ${'12'}                                      | ${'12'} |       ${'12'}                                      | ${'12'} | ||||||
| @@ -100,9 +104,27 @@ describe('main tests', () => { | |||||||
|       ${'unknown format'}                          | ${'unknown format'} |       ${'unknown format'}                          | ${'unknown format'} | ||||||
|       ${'  14.1.0  '}                              | ${'14.1.0'} |       ${'  14.1.0  '}                              | ${'14.1.0'} | ||||||
|       ${'{"volta": {"node": ">=14.0.0 <=17.0.0"}}'}| ${'>=14.0.0 <=17.0.0'} |       ${'{"volta": {"node": ">=14.0.0 <=17.0.0"}}'}| ${'>=14.0.0 <=17.0.0'} | ||||||
|  |       ${'{"volta": {"extends": "./package.json"}}'}| ${'18.0.0'} | ||||||
|       ${'{"engines": {"node": "17.0.0"}}'}         | ${'17.0.0'} |       ${'{"engines": {"node": "17.0.0"}}'}         | ${'17.0.0'} | ||||||
|  |       ${'{}'}                                      | ${null} | ||||||
|     `.it('parses "$contents"', ({contents, expected}) => { |     `.it('parses "$contents"', ({contents, expected}) => { | ||||||
|       expect(util.parseNodeVersionFile(contents)).toBe(expected); |       const existsSpy = jest.spyOn(fs, 'existsSync'); | ||||||
|  |       existsSpy.mockImplementation(() => true); | ||||||
|  |  | ||||||
|  |       const readFileSpy = jest.spyOn(fs, 'readFileSync'); | ||||||
|  |       readFileSpy.mockImplementation(filePath => { | ||||||
|  |         if ( | ||||||
|  |           typeof filePath === 'string' && | ||||||
|  |           path.basename(filePath) === 'package.json' | ||||||
|  |         ) { | ||||||
|  |           // Special case for volta.extends | ||||||
|  |           return '{"volta": {"node": "18.0.0"}}'; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return contents; | ||||||
|  |       }); | ||||||
|  |  | ||||||
|  |       expect(util.getNodeVersionFromFile('file')).toBe(expected); | ||||||
|     }); |     }); | ||||||
|   }); |   }); | ||||||
|  |  | ||||||
| @@ -125,6 +147,10 @@ describe('main tests', () => { | |||||||
|         return {stdout: obj[command], stderr: '', exitCode: 0}; |         return {stdout: obj[command], stderr: '', exitCode: 0}; | ||||||
|       }); |       }); | ||||||
|  |  | ||||||
|  |       whichSpy.mockImplementation(cmd => { | ||||||
|  |         return `some/${cmd}/path`; | ||||||
|  |       }); | ||||||
|  |  | ||||||
|       await util.printEnvDetailsAndSetOutput(); |       await util.printEnvDetailsAndSetOutput(); | ||||||
|  |  | ||||||
|       expect(setOutputSpy).toHaveBeenCalledWith('node-version', obj['node']); |       expect(setOutputSpy).toHaveBeenCalledWith('node-version', obj['node']); | ||||||
| @@ -141,10 +167,17 @@ describe('main tests', () => { | |||||||
|  |  | ||||||
|   describe('node-version-file flag', () => { |   describe('node-version-file flag', () => { | ||||||
|     beforeEach(() => { |     beforeEach(() => { | ||||||
|       parseNodeVersionSpy = jest.spyOn(util, 'parseNodeVersionFile'); |       delete inputs['node-version']; | ||||||
|  |       inputs['node-version-file'] = '.nvmrc'; | ||||||
|  |  | ||||||
|  |       getNodeVersionFromFileSpy = jest.spyOn(util, 'getNodeVersionFromFile'); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     it('not used if node-version is provided', async () => { |     afterEach(() => { | ||||||
|  |       getNodeVersionFromFileSpy.mockRestore(); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     it('does not read node-version-file if node-version is provided', async () => { | ||||||
|       // Arrange |       // Arrange | ||||||
|       inputs['node-version'] = '12'; |       inputs['node-version'] = '12'; | ||||||
|  |  | ||||||
| @@ -152,107 +185,54 @@ describe('main tests', () => { | |||||||
|       await main.run(); |       await main.run(); | ||||||
|  |  | ||||||
|       // Assert |       // Assert | ||||||
|       expect(parseNodeVersionSpy).toHaveBeenCalledTimes(0); |       expect(inputs['node-version']).toBeDefined(); | ||||||
|     }, 10000); |       expect(inputs['node-version-file']).toBeDefined(); | ||||||
|  |       expect(getNodeVersionFromFileSpy).not.toHaveBeenCalled(); | ||||||
|     it('not used if node-version-file not provided', async () => { |  | ||||||
|       // Act |  | ||||||
|       await main.run(); |  | ||||||
|  |  | ||||||
|       // Assert |  | ||||||
|       expect(parseNodeVersionSpy).toHaveBeenCalledTimes(0); |  | ||||||
|     }); |  | ||||||
|  |  | ||||||
|     it('reads node-version-file if provided', async () => { |  | ||||||
|       // Arrange |  | ||||||
|       const versionSpec = 'v14'; |  | ||||||
|       const versionFile = '.nvmrc'; |  | ||||||
|       const expectedVersionSpec = '14'; |  | ||||||
|       process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); |  | ||||||
|       inputs['node-version-file'] = versionFile; |  | ||||||
|  |  | ||||||
|       parseNodeVersionSpy.mockImplementation(() => expectedVersionSpec); |  | ||||||
|       existsSpy.mockImplementationOnce( |  | ||||||
|         input => input === path.join(__dirname, 'data', versionFile) |  | ||||||
|       ); |  | ||||||
|  |  | ||||||
|       // Act |  | ||||||
|       await main.run(); |  | ||||||
|  |  | ||||||
|       // Assert |  | ||||||
|       expect(existsSpy).toHaveBeenCalledTimes(1); |  | ||||||
|       expect(existsSpy).toHaveReturnedWith(true); |  | ||||||
|       expect(parseNodeVersionSpy).toHaveBeenCalledWith(versionSpec); |  | ||||||
|       expect(infoSpy).toHaveBeenCalledWith( |  | ||||||
|         `Resolved ${versionFile} as ${expectedVersionSpec}` |  | ||||||
|       ); |  | ||||||
|     }, 10000); |  | ||||||
|  |  | ||||||
|     it('reads package.json as node-version-file if provided', async () => { |  | ||||||
|       // Arrange |  | ||||||
|       const versionSpec = fs.readFileSync( |  | ||||||
|         path.join(__dirname, 'data/package.json'), |  | ||||||
|         'utf-8' |  | ||||||
|       ); |  | ||||||
|       const versionFile = 'package.json'; |  | ||||||
|       const expectedVersionSpec = '14'; |  | ||||||
|       process.env['GITHUB_WORKSPACE'] = path.join(__dirname, 'data'); |  | ||||||
|       inputs['node-version-file'] = versionFile; |  | ||||||
|  |  | ||||||
|       parseNodeVersionSpy.mockImplementation(() => expectedVersionSpec); |  | ||||||
|       existsSpy.mockImplementationOnce( |  | ||||||
|         input => input === path.join(__dirname, 'data', versionFile) |  | ||||||
|       ); |  | ||||||
|       // Act |  | ||||||
|       await main.run(); |  | ||||||
|  |  | ||||||
|       // Assert |  | ||||||
|       expect(existsSpy).toHaveBeenCalledTimes(1); |  | ||||||
|       expect(existsSpy).toHaveReturnedWith(true); |  | ||||||
|       expect(parseNodeVersionSpy).toHaveBeenCalledWith(versionSpec); |  | ||||||
|       expect(infoSpy).toHaveBeenCalledWith( |  | ||||||
|         `Resolved ${versionFile} as ${expectedVersionSpec}` |  | ||||||
|       ); |  | ||||||
|     }, 10000); |  | ||||||
|  |  | ||||||
|     it('both node-version-file and node-version are provided', async () => { |  | ||||||
|       inputs['node-version'] = '12'; |  | ||||||
|       const versionSpec = 'v14'; |  | ||||||
|       const versionFile = '.nvmrc'; |  | ||||||
|       const expectedVersionSpec = '14'; |  | ||||||
|       process.env['GITHUB_WORKSPACE'] = path.join(__dirname, '..'); |  | ||||||
|       inputs['node-version-file'] = versionFile; |  | ||||||
|  |  | ||||||
|       parseNodeVersionSpy.mockImplementation(() => expectedVersionSpec); |  | ||||||
|  |  | ||||||
|       // Act |  | ||||||
|       await main.run(); |  | ||||||
|  |  | ||||||
|       // Assert |  | ||||||
|       expect(existsSpy).toHaveBeenCalledTimes(0); |  | ||||||
|       expect(parseNodeVersionSpy).not.toHaveBeenCalled(); |  | ||||||
|       expect(warningSpy).toHaveBeenCalledWith( |       expect(warningSpy).toHaveBeenCalledWith( | ||||||
|         'Both node-version and node-version-file inputs are specified, only node-version will be used' |         'Both node-version and node-version-file inputs are specified, only node-version will be used' | ||||||
|       ); |       ); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     it('should throw an error if node-version-file is not found', async () => { |     it('does not read node-version-file if node-version-file is not provided', async () => { | ||||||
|       const versionFile = '.nvmrc'; |       // Arrange | ||||||
|       const versionFilePath = path.join(__dirname, '..', versionFile); |       delete inputs['node-version-file']; | ||||||
|       inputs['node-version-file'] = versionFile; |  | ||||||
|  |  | ||||||
|       inSpy.mockImplementation(name => inputs[name]); |       // Act | ||||||
|       existsSpy.mockImplementationOnce( |       await main.run(); | ||||||
|         input => input === path.join(__dirname, 'data', versionFile) |  | ||||||
|  |       // Assert | ||||||
|  |       expect(getNodeVersionFromFileSpy).not.toHaveBeenCalled(); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|  |     it('reads node-version-file', async () => { | ||||||
|  |       // Arrange | ||||||
|  |       const expectedVersionSpec = '14'; | ||||||
|  |       getNodeVersionFromFileSpy.mockImplementation(() => expectedVersionSpec); | ||||||
|  |  | ||||||
|  |       // Act | ||||||
|  |       await main.run(); | ||||||
|  |  | ||||||
|  |       // Assert | ||||||
|  |       expect(getNodeVersionFromFileSpy).toHaveBeenCalled(); | ||||||
|  |       expect(infoSpy).toHaveBeenCalledWith( | ||||||
|  |         `Resolved ${inputs['node-version-file']} as ${expectedVersionSpec}` | ||||||
|  |       ); | ||||||
|  |     }, 10000); | ||||||
|  |  | ||||||
|  |     it('should throw an error if node-version-file is not accessible', async () => { | ||||||
|  |       // Arrange | ||||||
|  |       inputs['node-version-file'] = 'non-existing-file'; | ||||||
|  |       const versionFilePath = path.join( | ||||||
|  |         __dirname, | ||||||
|  |         'data', | ||||||
|  |         inputs['node-version-file'] | ||||||
|       ); |       ); | ||||||
|  |  | ||||||
|       // Act |       // Act | ||||||
|       await main.run(); |       await main.run(); | ||||||
|  |  | ||||||
|       // Assert |       // Assert | ||||||
|       expect(existsSpy).toHaveBeenCalled(); |       expect(getNodeVersionFromFileSpy).toHaveBeenCalled(); | ||||||
|       expect(existsSpy).toHaveReturnedWith(false); |  | ||||||
|       expect(parseNodeVersionSpy).not.toHaveBeenCalled(); |  | ||||||
|       expect(cnSpy).toHaveBeenCalledWith( |       expect(cnSpy).toHaveBeenCalledWith( | ||||||
|         `::error::The specified node version file at: ${versionFilePath} does not exist${osm.EOL}` |         `::error::The specified node version file at: ${versionFilePath} does not exist${osm.EOL}` | ||||||
|       ); |       ); | ||||||
|   | |||||||
| @@ -248,6 +248,9 @@ describe('setup-node', () => { | |||||||
|     const toolPath = path.normalize('/cache/node/12.16.2/x64'); |     const toolPath = path.normalize('/cache/node/12.16.2/x64'); | ||||||
|     exSpy.mockImplementation(async () => '/some/other/temp/path'); |     exSpy.mockImplementation(async () => '/some/other/temp/path'); | ||||||
|     cacheSpy.mockImplementation(async () => toolPath); |     cacheSpy.mockImplementation(async () => toolPath); | ||||||
|  |     whichSpy.mockImplementation(cmd => { | ||||||
|  |       return `some/${cmd}/path`; | ||||||
|  |     }); | ||||||
|  |  | ||||||
|     await main.run(); |     await main.run(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -8,7 +8,7 @@ inputs: | |||||||
|   node-version: |   node-version: | ||||||
|     description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.' |     description: 'Version Spec of the version to use. Examples: 12.x, 10.15.1, >=10.15.0.' | ||||||
|   node-version-file: |   node-version-file: | ||||||
|     description: 'File containing the version Spec of the version to use.  Examples: .nvmrc, .node-version, .tool-versions.' |     description: 'File containing the version Spec of the version to use.  Examples: package.json, .nvmrc, .node-version, .tool-versions.' | ||||||
|   architecture: |   architecture: | ||||||
|     description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.' |     description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.' | ||||||
|   check-latest: |   check-latest: | ||||||
|   | |||||||
							
								
								
									
										1154
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1154
									
								
								dist/cache-save/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1210
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1210
									
								
								dist/setup/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -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@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: '16' |     node-version: '16' | ||||||
|     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@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version-file: '.nvmrc' |     node-version-file: '.nvmrc' | ||||||
| - run: npm ci | - run: npm ci | ||||||
| @@ -84,6 +84,8 @@ When using the `package.json` input, the action will look for `volta.node` first | |||||||
| } | } | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
|  | Otherwise, when [`volta.extends`](https://docs.volta.sh/advanced/workspaces) is defined, then it will resolve the corresponding file and look for `volta.node` or `engines.node` recursively. | ||||||
|  |  | ||||||
| ## Architecture | ## Architecture | ||||||
|  |  | ||||||
| You can use any of the [supported operating systems](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners), and the compatible `architecture` can be selected using `architecture`. Values are `x86`, `x64`, `arm64`, `armv6l`, `armv7l`, `ppc64le`, `s390x` (not all of the architectures are available on all platforms). | You can use any of the [supported operating systems](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners), and the compatible `architecture` can be selected using `architecture`. Values are `x86`, `x64`, `arm64`, `armv6l`, `armv7l`, `ppc64le`, `s390x` (not all of the architectures are available on all platforms). | ||||||
| @@ -96,7 +98,7 @@ jobs: | |||||||
|     name: Node sample |     name: Node sample | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - uses: actions/setup-node@v3 |       - uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: '14' |           node-version: '14' | ||||||
|           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 | ||||||
| @@ -117,7 +119,7 @@ jobs: | |||||||
|     name: Node sample |     name: Node sample | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - uses: actions/setup-node@v3 |       - uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: '20.0.0-v8-canary' # it will install the latest v8 canary release for node 20.0.0 |           node-version: '20.0.0-v8-canary' # it will install the latest v8 canary release for node 20.0.0 | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
| @@ -132,7 +134,7 @@ jobs: | |||||||
|     name: Node sample |     name: Node sample | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - uses: actions/setup-node@v3 |       - uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: '20-v8-canary' # it will install the latest v8 canary release for node 20 |           node-version: '20-v8-canary' # it will install the latest v8 canary release for node 20 | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
| @@ -148,7 +150,7 @@ jobs: | |||||||
|     name: Node sample |     name: Node sample | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - uses: actions/setup-node@v3 |       - uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: 'v20.1.1-v8-canary20221103f7e2421e91' |           node-version: 'v20.1.1-v8-canary20221103f7e2421e91' | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
| @@ -168,7 +170,7 @@ jobs: | |||||||
|     name: Node sample |     name: Node sample | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - uses: actions/setup-node@v3 |       - uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: '16-nightly' # it will install the latest nightly release for node 16 |           node-version: '16-nightly' # it will install the latest nightly release for node 16 | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
| @@ -184,7 +186,7 @@ jobs: | |||||||
|     name: Node sample |     name: Node sample | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - uses: actions/setup-node@v3 |       - uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: '16.0.0-nightly' # it will install the latest nightly release for node 16.0.0 |           node-version: '16.0.0-nightly' # it will install the latest nightly release for node 16.0.0 | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
| @@ -200,7 +202,7 @@ jobs: | |||||||
|     name: Node sample |     name: Node sample | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - uses: actions/setup-node@v3 |       - uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: '16.0.0-nightly20210420a0261d231c' |           node-version: '16.0.0-nightly20210420a0261d231c' | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
| @@ -218,7 +220,7 @@ jobs: | |||||||
|     name: Node sample |     name: Node sample | ||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - uses: actions/setup-node@v3 |       - uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: '16.0.0-rc.1' |           node-version: '16.0.0-rc.1' | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
| @@ -235,7 +237,7 @@ Yarn caching handles both yarn versions: 1 or 2. | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: '14' |     node-version: '14' | ||||||
|     cache: 'yarn' |     cache: 'yarn' | ||||||
| @@ -257,7 +259,7 @@ steps: | |||||||
| - uses: pnpm/action-setup@v2 | - uses: pnpm/action-setup@v2 | ||||||
|   with: |   with: | ||||||
|     version: 6.32.9 |     version: 6.32.9 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: '14' |     node-version: '14' | ||||||
|     cache: 'pnpm' |     cache: 'pnpm' | ||||||
| @@ -273,7 +275,7 @@ steps: | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: '14' |     node-version: '14' | ||||||
|     cache: 'npm' |     cache: 'npm' | ||||||
| @@ -286,7 +288,7 @@ steps: | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: '14' |     node-version: '14' | ||||||
|     cache: 'npm' |     cache: 'npm' | ||||||
| @@ -324,7 +326,7 @@ jobs: | |||||||
|     steps: |     steps: | ||||||
|       - uses: actions/checkout@v4 |       - uses: actions/checkout@v4 | ||||||
|       - name: Setup node |       - name: Setup node | ||||||
|         uses: actions/setup-node@v3 |         uses: actions/setup-node@v4 | ||||||
|         with: |         with: | ||||||
|           node-version: ${{ matrix.node_version }} |           node-version: ${{ matrix.node_version }} | ||||||
|           architecture: ${{ matrix.architecture }} |           architecture: ${{ matrix.architecture }} | ||||||
| @@ -336,7 +338,7 @@ jobs: | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: '14.x' |     node-version: '14.x' | ||||||
|     registry-url: 'https://registry.npmjs.org' |     registry-url: 'https://registry.npmjs.org' | ||||||
| @@ -344,7 +346,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@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     registry-url: 'https://npm.pkg.github.com' |     registry-url: 'https://npm.pkg.github.com' | ||||||
| - run: npm publish | - run: npm publish | ||||||
| @@ -356,7 +358,7 @@ steps: | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: '14.x' |     node-version: '14.x' | ||||||
|     registry-url: <registry url> |     registry-url: <registry url> | ||||||
| @@ -364,7 +366,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@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     registry-url: 'https://npm.pkg.github.com' |     registry-url: 'https://npm.pkg.github.com' | ||||||
| - run: yarn publish | - run: yarn publish | ||||||
| @@ -376,7 +378,7 @@ steps: | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: '14.x' |     node-version: '14.x' | ||||||
|     registry-url: 'https://registry.npmjs.org' |     registry-url: 'https://registry.npmjs.org' | ||||||
| @@ -396,7 +398,7 @@ Below you can find a sample "Setup .yarnrc.yml" step, that is going to allow you | |||||||
| ```yaml | ```yaml | ||||||
| steps: | steps: | ||||||
| - uses: actions/checkout@v4 | - uses: actions/checkout@v4 | ||||||
| - uses: actions/setup-node@v3 | - uses: actions/setup-node@v4 | ||||||
|   with: |   with: | ||||||
|     node-version: '14.x' |     node-version: '14.x' | ||||||
| - name: Setup .yarnrc.yml | - name: Setup .yarnrc.yml | ||||||
|   | |||||||
							
								
								
									
										152
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										152
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -9,34 +9,34 @@ | |||||||
|       "version": "4.0.0", |       "version": "4.0.0", | ||||||
|       "license": "MIT", |       "license": "MIT", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@actions/cache": "^3.0.4", |         "@actions/cache": "^3.2.4", | ||||||
|         "@actions/core": "^1.10.0", |         "@actions/core": "^1.10.0", | ||||||
|         "@actions/exec": "^1.1.0", |         "@actions/exec": "^1.1.0", | ||||||
|         "@actions/github": "^5.1.1", |         "@actions/github": "^5.1.1", | ||||||
|         "@actions/glob": "^0.4.0", |         "@actions/glob": "^0.4.0", | ||||||
|         "@actions/http-client": "^2.1.1", |         "@actions/http-client": "^2.2.1", | ||||||
|         "@actions/io": "^1.0.2", |         "@actions/io": "^1.0.2", | ||||||
|         "@actions/tool-cache": "^2.0.1", |         "@actions/tool-cache": "^2.0.1", | ||||||
|         "semver": "^7.5.4", |         "semver": "^7.6.0", | ||||||
|         "uuid": "^9.0.1" |         "uuid": "^9.0.1" | ||||||
|       }, |       }, | ||||||
|       "devDependencies": { |       "devDependencies": { | ||||||
|         "@types/jest": "^29.5.5", |         "@types/jest": "^29.5.12", | ||||||
|         "@types/node": "^20.8.2", |         "@types/node": "^20.11.25", | ||||||
|         "@types/semver": "^7.5.3", |         "@types/semver": "^7.5.8", | ||||||
|         "@typescript-eslint/eslint-plugin": "^5.54.0", |         "@typescript-eslint/eslint-plugin": "^5.54.0", | ||||||
|         "@typescript-eslint/parser": "^5.54.0", |         "@typescript-eslint/parser": "^5.54.0", | ||||||
|         "@vercel/ncc": "^0.38.0", |         "@vercel/ncc": "^0.38.0", | ||||||
|         "eslint": "^8.35.0", |         "eslint": "^8.57.0", | ||||||
|         "eslint-config-prettier": "^8.6.0", |         "eslint-config-prettier": "^8.6.0", | ||||||
|         "eslint-plugin-jest": "^27.2.1", |         "eslint-plugin-jest": "^27.9.0", | ||||||
|         "eslint-plugin-node": "^11.1.0", |         "eslint-plugin-node": "^11.1.0", | ||||||
|         "jest": "^29.7.0", |         "jest": "^29.7.0", | ||||||
|         "jest-circus": "^29.7.0", |         "jest-circus": "^29.7.0", | ||||||
|         "jest-each": "^29.7.0", |         "jest-each": "^29.7.0", | ||||||
|         "prettier": "^2.8.4", |         "prettier": "^2.8.4", | ||||||
|         "ts-jest": "^29.1.1", |         "ts-jest": "^29.1.2", | ||||||
|         "typescript": "^5.2.2" |         "typescript": "^5.4.2" | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@aashutoshrathi/word-wrap": { |     "node_modules/@aashutoshrathi/word-wrap": { | ||||||
| @@ -49,9 +49,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@actions/cache": { |     "node_modules/@actions/cache": { | ||||||
|       "version": "3.2.2", |       "version": "3.2.4", | ||||||
|       "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.2.2.tgz", |       "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-3.2.4.tgz", | ||||||
|       "integrity": "sha512-6D0Jq5JrLZRQ3VApeQwQkkV20ZZXjXsHNYXd9VjNUdi9E0h93wESpxfMJ2JWLCUCgHNLcfY0v3GjNM+2FdRMlg==", |       "integrity": "sha512-RuHnwfcDagtX+37s0ZWy7clbOfnZ7AlDJQ7k/9rzt2W4Gnwde3fa/qjSjVuz4vLcLIpc7fUob27CMrqiWZytYA==", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@actions/core": "^1.10.0", |         "@actions/core": "^1.10.0", | ||||||
|         "@actions/exec": "^1.0.1", |         "@actions/exec": "^1.0.1", | ||||||
| @@ -61,7 +61,7 @@ | |||||||
|         "@azure/abort-controller": "^1.1.0", |         "@azure/abort-controller": "^1.1.0", | ||||||
|         "@azure/ms-rest-js": "^2.6.0", |         "@azure/ms-rest-js": "^2.6.0", | ||||||
|         "@azure/storage-blob": "^12.13.0", |         "@azure/storage-blob": "^12.13.0", | ||||||
|         "semver": "^6.1.0", |         "semver": "^6.3.1", | ||||||
|         "uuid": "^3.3.3" |         "uuid": "^3.3.3" | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
| @@ -137,9 +137,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@actions/http-client": { |     "node_modules/@actions/http-client": { | ||||||
|       "version": "2.2.0", |       "version": "2.2.1", | ||||||
|       "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.0.tgz", |       "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.2.1.tgz", | ||||||
|       "integrity": "sha512-q+epW0trjVUUHboliPb4UF9g2msf+w61b32tAkFEwL/IwP0DQWgbCMM0Hbe3e3WXSKz5VcUXbzJQgy8Hkra/Lg==", |       "integrity": "sha512-KhC/cZsq7f8I4LfZSJKgCvEwfkE8o1538VoBeoGzokVLLnbFDEAdFD3UhoMklxo2un9NJVBdANOresx7vTHlHw==", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "tunnel": "^0.0.6", |         "tunnel": "^0.0.6", | ||||||
|         "undici": "^5.25.4" |         "undici": "^5.25.4" | ||||||
| @@ -1042,9 +1042,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@eslint/eslintrc": { |     "node_modules/@eslint/eslintrc": { | ||||||
|       "version": "2.1.2", |       "version": "2.1.4", | ||||||
|       "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.2.tgz", |       "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.4.tgz", | ||||||
|       "integrity": "sha512-+wvgpDsrB1YqAMdEUCcnTlpfVBH7Vqn6A/NT3D8WVXFIaKMlErPIZT3oCIAVCOtarRpMtelZLqJeU3t7WY6X6g==", |       "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "ajv": "^6.12.4", |         "ajv": "^6.12.4", | ||||||
| @@ -1065,9 +1065,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@eslint/js": { |     "node_modules/@eslint/js": { | ||||||
|       "version": "8.52.0", |       "version": "8.57.0", | ||||||
|       "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", |       "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.57.0.tgz", | ||||||
|       "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", |       "integrity": "sha512-Ys+3g2TaW7gADOJzPt83SJtCDhMjndcDMFVQ/Tj9iA1BfJzFKD9mAUXT3OenpuPHbI6P/myECxRJrofUsDx/5g==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "engines": { |       "engines": { | ||||||
|         "node": "^12.22.0 || ^14.17.0 || >=16.0.0" |         "node": "^12.22.0 || ^14.17.0 || >=16.0.0" | ||||||
| @@ -1082,13 +1082,13 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@humanwhocodes/config-array": { |     "node_modules/@humanwhocodes/config-array": { | ||||||
|       "version": "0.11.13", |       "version": "0.11.14", | ||||||
|       "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", |       "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.14.tgz", | ||||||
|       "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", |       "integrity": "sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@humanwhocodes/object-schema": "^2.0.1", |         "@humanwhocodes/object-schema": "^2.0.2", | ||||||
|         "debug": "^4.1.1", |         "debug": "^4.3.1", | ||||||
|         "minimatch": "^3.0.5" |         "minimatch": "^3.0.5" | ||||||
|       }, |       }, | ||||||
|       "engines": { |       "engines": { | ||||||
| @@ -1109,9 +1109,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@humanwhocodes/object-schema": { |     "node_modules/@humanwhocodes/object-schema": { | ||||||
|       "version": "2.0.1", |       "version": "2.0.2", | ||||||
|       "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", |       "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.2.tgz", | ||||||
|       "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", |       "integrity": "sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==", | ||||||
|       "dev": true |       "dev": true | ||||||
|     }, |     }, | ||||||
|     "node_modules/@istanbuljs/load-nyc-config": { |     "node_modules/@istanbuljs/load-nyc-config": { | ||||||
| @@ -1791,9 +1791,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@types/jest": { |     "node_modules/@types/jest": { | ||||||
|       "version": "29.5.6", |       "version": "29.5.12", | ||||||
|       "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.6.tgz", |       "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz", | ||||||
|       "integrity": "sha512-/t9NnzkOpXb4Nfvg17ieHE6EeSjDS2SGSpNYfoLbUAeL/EOueU/RSdOWFpfQTXBEM7BguYW1XQ0EbM+6RlIh6w==", |       "integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "expect": "^29.0.0", |         "expect": "^29.0.0", | ||||||
| @@ -1807,11 +1807,11 @@ | |||||||
|       "dev": true |       "dev": true | ||||||
|     }, |     }, | ||||||
|     "node_modules/@types/node": { |     "node_modules/@types/node": { | ||||||
|       "version": "20.8.7", |       "version": "20.11.25", | ||||||
|       "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.7.tgz", |       "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.25.tgz", | ||||||
|       "integrity": "sha512-21TKHHh3eUHIi2MloeptJWALuCu5H7HQTdTrWIFReA8ad+aggoX+lRes3ex7/FtpC+sVUpFMQ+QTfYr74mruiQ==", |       "integrity": "sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "undici-types": "~5.25.1" |         "undici-types": "~5.26.4" | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@types/node-fetch": { |     "node_modules/@types/node-fetch": { | ||||||
| @@ -1837,9 +1837,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/@types/semver": { |     "node_modules/@types/semver": { | ||||||
|       "version": "7.5.4", |       "version": "7.5.8", | ||||||
|       "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", |       "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", | ||||||
|       "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", |       "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", | ||||||
|       "dev": true |       "dev": true | ||||||
|     }, |     }, | ||||||
|     "node_modules/@types/stack-utils": { |     "node_modules/@types/stack-utils": { | ||||||
| @@ -2086,9 +2086,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/acorn": { |     "node_modules/acorn": { | ||||||
|       "version": "8.10.0", |       "version": "8.11.3", | ||||||
|       "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", |       "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz", | ||||||
|       "integrity": "sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==", |       "integrity": "sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "bin": { |       "bin": { | ||||||
|         "acorn": "bin/acorn" |         "acorn": "bin/acorn" | ||||||
| @@ -2757,16 +2757,16 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/eslint": { |     "node_modules/eslint": { | ||||||
|       "version": "8.52.0", |       "version": "8.57.0", | ||||||
|       "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", |       "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.57.0.tgz", | ||||||
|       "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", |       "integrity": "sha512-dZ6+mexnaTIbSBZWgou51U6OmzIhYM2VcNdtiTtI7qPNZm35Akpr0f6vtw3w1Kmn5PYo+tZVfh13WrhpS6oLqQ==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@eslint-community/eslint-utils": "^4.2.0", |         "@eslint-community/eslint-utils": "^4.2.0", | ||||||
|         "@eslint-community/regexpp": "^4.6.1", |         "@eslint-community/regexpp": "^4.6.1", | ||||||
|         "@eslint/eslintrc": "^2.1.2", |         "@eslint/eslintrc": "^2.1.4", | ||||||
|         "@eslint/js": "8.52.0", |         "@eslint/js": "8.57.0", | ||||||
|         "@humanwhocodes/config-array": "^0.11.13", |         "@humanwhocodes/config-array": "^0.11.14", | ||||||
|         "@humanwhocodes/module-importer": "^1.0.1", |         "@humanwhocodes/module-importer": "^1.0.1", | ||||||
|         "@nodelib/fs.walk": "^1.2.8", |         "@nodelib/fs.walk": "^1.2.8", | ||||||
|         "@ungap/structured-clone": "^1.2.0", |         "@ungap/structured-clone": "^1.2.0", | ||||||
| @@ -2843,9 +2843,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/eslint-plugin-jest": { |     "node_modules/eslint-plugin-jest": { | ||||||
|       "version": "27.4.3", |       "version": "27.9.0", | ||||||
|       "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.4.3.tgz", |       "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.9.0.tgz", | ||||||
|       "integrity": "sha512-7S6SmmsHsgIm06BAGCAxL+ABd9/IB3MWkz2pudj6Qqor2y1qQpWPfuFU4SG9pWj4xDjF0e+D7Llh5useuSzAZw==", |       "integrity": "sha512-QIT7FH7fNmd9n4se7FFKHbsLKGQiw885Ds6Y/sxKgCZ6natwCsXdgPOADnYVxN2QrRweF0FZWbJ6S7Rsn7llug==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@typescript-eslint/utils": "^5.10.0" |         "@typescript-eslint/utils": "^5.10.0" | ||||||
| @@ -2854,7 +2854,7 @@ | |||||||
|         "node": "^14.15.0 || ^16.10.0 || >=18.0.0" |         "node": "^14.15.0 || ^16.10.0 || >=18.0.0" | ||||||
|       }, |       }, | ||||||
|       "peerDependencies": { |       "peerDependencies": { | ||||||
|         "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0", |         "@typescript-eslint/eslint-plugin": "^5.0.0 || ^6.0.0 || ^7.0.0", | ||||||
|         "eslint": "^7.0.0 || ^8.0.0", |         "eslint": "^7.0.0 || ^8.0.0", | ||||||
|         "jest": "*" |         "jest": "*" | ||||||
|       }, |       }, | ||||||
| @@ -3362,9 +3362,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/globals": { |     "node_modules/globals": { | ||||||
|       "version": "13.23.0", |       "version": "13.24.0", | ||||||
|       "resolved": "https://registry.npmjs.org/globals/-/globals-13.23.0.tgz", |       "resolved": "https://registry.npmjs.org/globals/-/globals-13.24.0.tgz", | ||||||
|       "integrity": "sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==", |       "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "type-fest": "^0.20.2" |         "type-fest": "^0.20.2" | ||||||
| @@ -4864,9 +4864,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/punycode": { |     "node_modules/punycode": { | ||||||
|       "version": "2.3.0", |       "version": "2.3.1", | ||||||
|       "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", |       "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", | ||||||
|       "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", |       "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "engines": { |       "engines": { | ||||||
|         "node": ">=6" |         "node": ">=6" | ||||||
| @@ -5045,9 +5045,9 @@ | |||||||
|       "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" |       "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==" | ||||||
|     }, |     }, | ||||||
|     "node_modules/semver": { |     "node_modules/semver": { | ||||||
|       "version": "7.5.4", |       "version": "7.6.0", | ||||||
|       "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", |       "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", | ||||||
|       "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", |       "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "lru-cache": "^6.0.0" |         "lru-cache": "^6.0.0" | ||||||
|       }, |       }, | ||||||
| @@ -5308,9 +5308,9 @@ | |||||||
|       "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" |       "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" | ||||||
|     }, |     }, | ||||||
|     "node_modules/ts-jest": { |     "node_modules/ts-jest": { | ||||||
|       "version": "29.1.1", |       "version": "29.1.2", | ||||||
|       "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", |       "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.2.tgz", | ||||||
|       "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", |       "integrity": "sha512-br6GJoH/WUX4pu7FbZXuWGKGNDuU7b8Uj77g/Sp7puZV6EXzuByl6JrECvm0MzVzSTkSHWTihsXt+5XYER5b+g==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "bs-logger": "0.x", |         "bs-logger": "0.x", | ||||||
| @@ -5326,7 +5326,7 @@ | |||||||
|         "ts-jest": "cli.js" |         "ts-jest": "cli.js" | ||||||
|       }, |       }, | ||||||
|       "engines": { |       "engines": { | ||||||
|         "node": "^14.15.0 || ^16.10.0 || >=18.0.0" |         "node": "^16.10.0 || ^18.0.0 || >=20.0.0" | ||||||
|       }, |       }, | ||||||
|       "peerDependencies": { |       "peerDependencies": { | ||||||
|         "@babel/core": ">=7.0.0-beta.0 <8", |         "@babel/core": ">=7.0.0-beta.0 <8", | ||||||
| @@ -5418,9 +5418,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/typescript": { |     "node_modules/typescript": { | ||||||
|       "version": "5.2.2", |       "version": "5.4.2", | ||||||
|       "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", |       "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.2.tgz", | ||||||
|       "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", |       "integrity": "sha512-+2/g0Fds1ERlP6JsakQQDXjZdZMM+rqpamFZJEKh4kwTIn3iDkgKtby0CeNd5ATNZ4Ry1ax15TMx0W2V+miizQ==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "bin": { |       "bin": { | ||||||
|         "tsc": "bin/tsc", |         "tsc": "bin/tsc", | ||||||
| @@ -5431,9 +5431,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/undici": { |     "node_modules/undici": { | ||||||
|       "version": "5.26.5", |       "version": "5.28.3", | ||||||
|       "resolved": "https://registry.npmjs.org/undici/-/undici-5.26.5.tgz", |       "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.3.tgz", | ||||||
|       "integrity": "sha512-cSb4bPFd5qgR7qr2jYAi0hlX9n5YKK2ONKkLFkxl+v/9BvC0sOpZjBHDBSXc5lWAf5ty9oZdRXytBIHzgUcerw==", |       "integrity": "sha512-3ItfzbrhDlINjaP0duwnNsKpDQk3acHI3gVJ1z4fmwMK31k5G9OVIAMLSIaP6w4FaGkaAkN6zaQO9LUvZ1t7VA==", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@fastify/busboy": "^2.0.0" |         "@fastify/busboy": "^2.0.0" | ||||||
|       }, |       }, | ||||||
| @@ -5442,9 +5442,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "node_modules/undici-types": { |     "node_modules/undici-types": { | ||||||
|       "version": "5.25.3", |       "version": "5.26.5", | ||||||
|       "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.25.3.tgz", |       "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", | ||||||
|       "integrity": "sha512-Ga1jfYwRn7+cP9v8auvEXN1rX3sWqlayd4HP7OKk4mZWylEmu3KzXDUGrQUN6Ol7qo1gPvB2e5gX6udnyEPgdA==" |       "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" | ||||||
|     }, |     }, | ||||||
|     "node_modules/universal-user-agent": { |     "node_modules/universal-user-agent": { | ||||||
|       "version": "6.0.0", |       "version": "6.0.0", | ||||||
|   | |||||||
							
								
								
									
										20
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								package.json
									
									
									
									
									
								
							| @@ -25,33 +25,33 @@ | |||||||
|   "author": "GitHub", |   "author": "GitHub", | ||||||
|   "license": "MIT", |   "license": "MIT", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@actions/cache": "^3.0.4", |     "@actions/cache": "^3.2.4", | ||||||
|     "@actions/core": "^1.10.0", |     "@actions/core": "^1.10.0", | ||||||
|     "@actions/exec": "^1.1.0", |     "@actions/exec": "^1.1.0", | ||||||
|     "@actions/github": "^5.1.1", |     "@actions/github": "^5.1.1", | ||||||
|     "@actions/glob": "^0.4.0", |     "@actions/glob": "^0.4.0", | ||||||
|     "@actions/http-client": "^2.1.1", |     "@actions/http-client": "^2.2.1", | ||||||
|     "@actions/io": "^1.0.2", |     "@actions/io": "^1.0.2", | ||||||
|     "@actions/tool-cache": "^2.0.1", |     "@actions/tool-cache": "^2.0.1", | ||||||
|     "semver": "^7.5.4", |     "semver": "^7.6.0", | ||||||
|     "uuid": "^9.0.1" |     "uuid": "^9.0.1" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "@types/jest": "^29.5.5", |     "@types/jest": "^29.5.12", | ||||||
|     "@types/node": "^20.8.2", |     "@types/node": "^20.11.25", | ||||||
|     "@types/semver": "^7.5.3", |     "@types/semver": "^7.5.8", | ||||||
|     "@typescript-eslint/eslint-plugin": "^5.54.0", |     "@typescript-eslint/eslint-plugin": "^5.54.0", | ||||||
|     "@typescript-eslint/parser": "^5.54.0", |     "@typescript-eslint/parser": "^5.54.0", | ||||||
|     "@vercel/ncc": "^0.38.0", |     "@vercel/ncc": "^0.38.0", | ||||||
|     "eslint": "^8.35.0", |     "eslint": "^8.57.0", | ||||||
|     "eslint-config-prettier": "^8.6.0", |     "eslint-config-prettier": "^8.6.0", | ||||||
|     "eslint-plugin-jest": "^27.2.1", |     "eslint-plugin-jest": "^27.9.0", | ||||||
|     "eslint-plugin-node": "^11.1.0", |     "eslint-plugin-node": "^11.1.0", | ||||||
|     "jest": "^29.7.0", |     "jest": "^29.7.0", | ||||||
|     "jest-circus": "^29.7.0", |     "jest-circus": "^29.7.0", | ||||||
|     "jest-each": "^29.7.0", |     "jest-each": "^29.7.0", | ||||||
|     "prettier": "^2.8.4", |     "prettier": "^2.8.4", | ||||||
|     "ts-jest": "^29.1.1", |     "ts-jest": "^29.1.2", | ||||||
|     "typescript": "^5.2.2" |     "typescript": "^5.4.2" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -12,10 +12,20 @@ process.on('uncaughtException', e => { | |||||||
|   core.info(`${warningPrefix}${e.message}`); |   core.info(`${warningPrefix}${e.message}`); | ||||||
| }); | }); | ||||||
|  |  | ||||||
| export async function run() { | // Added early exit to resolve issue with slow post action step: | ||||||
|  | export async function run(earlyExit?: boolean) { | ||||||
|   try { |   try { | ||||||
|     const cacheLock = core.getState(State.CachePackageManager); |     const cacheLock = core.getState(State.CachePackageManager); | ||||||
|  |  | ||||||
|  |     if (cacheLock) { | ||||||
|       await cachePackages(cacheLock); |       await cachePackages(cacheLock); | ||||||
|  |  | ||||||
|  |       if (earlyExit) { | ||||||
|  |         process.exit(0); | ||||||
|  |       } | ||||||
|  |     } else { | ||||||
|  |       core.debug(`Caching for '${cacheLock}' is not supported`); | ||||||
|  |     } | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     core.setFailed((error as Error).message); |     core.setFailed((error as Error).message); | ||||||
|   } |   } | ||||||
| @@ -58,4 +68,4 @@ const cachePackages = async (packageManager: string) => { | |||||||
|   core.info(`Cache saved with the key: ${primaryKey}`); |   core.info(`Cache saved with the key: ${primaryKey}`); | ||||||
| }; | }; | ||||||
|  |  | ||||||
| run(); | run(true); | ||||||
|   | |||||||
| @@ -112,7 +112,11 @@ export default abstract class BaseDistribution { | |||||||
|         ? `node-v${version}-win-${osArch}` |         ? `node-v${version}-win-${osArch}` | ||||||
|         : `node-v${version}-${this.osPlat}-${osArch}`; |         : `node-v${version}-${this.osPlat}-${osArch}`; | ||||||
|     const urlFileName: string = |     const urlFileName: string = | ||||||
|       this.osPlat == 'win32' ? `${fileName}.7z` : `${fileName}.tar.gz`; |       this.osPlat == 'win32' | ||||||
|  |         ? this.nodeInfo.arch === 'arm64' | ||||||
|  |           ? `${fileName}.zip` | ||||||
|  |           : `${fileName}.7z` | ||||||
|  |         : `${fileName}.tar.gz`; | ||||||
|     const initialUrl = this.getDistributionUrl(); |     const initialUrl = this.getDistributionUrl(); | ||||||
|     const url = `${initialUrl}/v${version}/${urlFileName}`; |     const url = `${initialUrl}/v${version}/${urlFileName}`; | ||||||
|  |  | ||||||
| @@ -215,12 +219,24 @@ export default abstract class BaseDistribution { | |||||||
|     let extPath: string; |     let extPath: string; | ||||||
|     info = info || ({} as INodeVersionInfo); // satisfy compiler, never null when reaches here |     info = info || ({} as INodeVersionInfo); // satisfy compiler, never null when reaches here | ||||||
|     if (this.osPlat == 'win32') { |     if (this.osPlat == 'win32') { | ||||||
|  |       const extension = this.nodeInfo.arch === 'arm64' ? '.zip' : '.7z'; | ||||||
|  |       // Rename archive to add extension because after downloading | ||||||
|  |       // archive does not contain extension type and it leads to some issues | ||||||
|  |       // on Windows runners without PowerShell Core. | ||||||
|  |       // | ||||||
|  |       // For default PowerShell Windows it should contain extension type to unpack it. | ||||||
|  |       if (extension === '.zip') { | ||||||
|  |         const renamedArchive = `${downloadPath}.zip`; | ||||||
|  |         fs.renameSync(downloadPath, renamedArchive); | ||||||
|  |         extPath = await tc.extractZip(renamedArchive); | ||||||
|  |       } else { | ||||||
|         const _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe'); |         const _7zPath = path.join(__dirname, '../..', 'externals', '7zr.exe'); | ||||||
|         extPath = await tc.extract7z(downloadPath, undefined, _7zPath); |         extPath = await tc.extract7z(downloadPath, undefined, _7zPath); | ||||||
|  |       } | ||||||
|       // 7z extracts to folder matching file name |       // 7z extracts to folder matching file name | ||||||
|       const nestedPath = path.join( |       const nestedPath = path.join( | ||||||
|         extPath, |         extPath, | ||||||
|         path.basename(info.fileName, '.7z') |         path.basename(info.fileName, extension) | ||||||
|       ); |       ); | ||||||
|       if (fs.existsSync(nestedPath)) { |       if (fs.existsSync(nestedPath)) { | ||||||
|         extPath = nestedPath; |         extPath = nestedPath; | ||||||
| @@ -260,7 +276,11 @@ export default abstract class BaseDistribution { | |||||||
|         dataFileName = `osx-${osArch}-tar`; |         dataFileName = `osx-${osArch}-tar`; | ||||||
|         break; |         break; | ||||||
|       case 'win32': |       case 'win32': | ||||||
|  |         if (this.nodeInfo.arch === 'arm64') { | ||||||
|  |           dataFileName = `win-${osArch}-zip`; | ||||||
|  |         } else { | ||||||
|           dataFileName = `win-${osArch}-exe`; |           dataFileName = `win-${osArch}-exe`; | ||||||
|  |         } | ||||||
|         break; |         break; | ||||||
|       default: |       default: | ||||||
|         throw new Error(`Unexpected OS '${this.osPlat}'`); |         throw new Error(`Unexpected OS '${this.osPlat}'`); | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								src/main.ts
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								src/main.ts
									
									
									
									
									
								
							| @@ -1,6 +1,5 @@ | |||||||
| import * as core from '@actions/core'; | import * as core from '@actions/core'; | ||||||
|  |  | ||||||
| import fs from 'fs'; |  | ||||||
| import os from 'os'; | import os from 'os'; | ||||||
|  |  | ||||||
| import * as auth from './authutil'; | import * as auth from './authutil'; | ||||||
| @@ -8,7 +7,7 @@ import * as path from 'path'; | |||||||
| import {restoreCache} from './cache-restore'; | import {restoreCache} from './cache-restore'; | ||||||
| import {isCacheFeatureAvailable} from './cache-utils'; | import {isCacheFeatureAvailable} from './cache-utils'; | ||||||
| import {getNodejsDistribution} from './distributions/installer-factory'; | import {getNodejsDistribution} from './distributions/installer-factory'; | ||||||
| import {parseNodeVersionFile, printEnvDetailsAndSetOutput} from './util'; | import {getNodeVersionFromFile, printEnvDetailsAndSetOutput} from './util'; | ||||||
| import {State} from './constants'; | import {State} from './constants'; | ||||||
|  |  | ||||||
| export async function run() { | export async function run() { | ||||||
| @@ -99,14 +98,16 @@ function resolveVersionInput(): string { | |||||||
|       versionFileInput |       versionFileInput | ||||||
|     ); |     ); | ||||||
|  |  | ||||||
|     if (!fs.existsSync(versionFilePath)) { |     const parsedVersion = getNodeVersionFromFile(versionFilePath); | ||||||
|       throw new Error( |  | ||||||
|         `The specified node version file at: ${versionFilePath} does not exist` |     if (parsedVersion) { | ||||||
|  |       version = parsedVersion; | ||||||
|  |     } else { | ||||||
|  |       core.warning( | ||||||
|  |         `Could not determine node version from ${versionFilePath}. Falling back` | ||||||
|       ); |       ); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     version = parseNodeVersionFile(fs.readFileSync(versionFilePath, 'utf8')); |  | ||||||
|  |  | ||||||
|     core.info(`Resolved ${versionFileInput} as ${version}`); |     core.info(`Resolved ${versionFileInput} as ${version}`); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										66
									
								
								src/util.ts
									
									
									
									
									
								
							
							
						
						
									
										66
									
								
								src/util.ts
									
									
									
									
									
								
							| @@ -1,34 +1,70 @@ | |||||||
| import * as core from '@actions/core'; | import * as core from '@actions/core'; | ||||||
| import * as exec from '@actions/exec'; | import * as exec from '@actions/exec'; | ||||||
|  | import * as io from '@actions/io'; | ||||||
|  |  | ||||||
| export function parseNodeVersionFile(contents: string): string { | import fs from 'fs'; | ||||||
|   let nodeVersion: string | undefined; | import path from 'path'; | ||||||
|  |  | ||||||
|  | export function getNodeVersionFromFile(versionFilePath: string): string | null { | ||||||
|  |   if (!fs.existsSync(versionFilePath)) { | ||||||
|  |     throw new Error( | ||||||
|  |       `The specified node version file at: ${versionFilePath} does not exist` | ||||||
|  |     ); | ||||||
|  |   } | ||||||
|  |  | ||||||
|  |   const contents = fs.readFileSync(versionFilePath, 'utf8'); | ||||||
|  |  | ||||||
|   // Try parsing the file as an NPM `package.json` file. |   // Try parsing the file as an NPM `package.json` file. | ||||||
|   try { |   try { | ||||||
|     nodeVersion = JSON.parse(contents).volta?.node; |     const manifest = JSON.parse(contents); | ||||||
|     if (!nodeVersion) nodeVersion = JSON.parse(contents).engines?.node; |  | ||||||
|  |     // Presume package.json file. | ||||||
|  |     if (typeof manifest === 'object' && !!manifest) { | ||||||
|  |       // Support Volta. | ||||||
|  |       // See https://docs.volta.sh/guide/understanding#managing-your-project | ||||||
|  |       if (manifest.volta?.node) { | ||||||
|  |         return manifest.volta.node; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       if (manifest.engines?.node) { | ||||||
|  |         return manifest.engines.node; | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       // Support Volta workspaces. | ||||||
|  |       // See https://docs.volta.sh/advanced/workspaces | ||||||
|  |       if (manifest.volta?.extends) { | ||||||
|  |         const extendedFilePath = path.resolve( | ||||||
|  |           path.dirname(versionFilePath), | ||||||
|  |           manifest.volta.extends | ||||||
|  |         ); | ||||||
|  |         core.info('Resolving node version from ' + extendedFilePath); | ||||||
|  |         return getNodeVersionFromFile(extendedFilePath); | ||||||
|  |       } | ||||||
|  |  | ||||||
|  |       // If contents are an object, we parsed JSON | ||||||
|  |       // this can happen if node-version-file is a package.json | ||||||
|  |       // yet contains no volta.node or engines.node | ||||||
|  |       // | ||||||
|  |       // If node-version file is _not_ JSON, control flow | ||||||
|  |       // will not have reached these lines. | ||||||
|  |       // | ||||||
|  |       // And because we've reached here, we know the contents | ||||||
|  |       // *are* JSON, so no further string parsing makes sense. | ||||||
|  |       return null; | ||||||
|  |     } | ||||||
|   } catch { |   } catch { | ||||||
|     core.info('Node version file is not JSON file'); |     core.info('Node version file is not JSON file'); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   if (!nodeVersion) { |  | ||||||
|   const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m); |   const found = contents.match(/^(?:node(js)?\s+)?v?(?<version>[^\s]+)$/m); | ||||||
|     nodeVersion = found?.groups?.version; |   return found?.groups?.version ?? contents.trim(); | ||||||
|   } |  | ||||||
|  |  | ||||||
|   // In the case of an unknown format, |  | ||||||
|   // return as is and evaluate the version separately. |  | ||||||
|   if (!nodeVersion) nodeVersion = contents.trim(); |  | ||||||
|  |  | ||||||
|   return nodeVersion as string; |  | ||||||
| } | } | ||||||
|  |  | ||||||
| export async function printEnvDetailsAndSetOutput() { | export async function printEnvDetailsAndSetOutput() { | ||||||
|   core.startGroup('Environment details'); |   core.startGroup('Environment details'); | ||||||
|  |  | ||||||
|   const promises = ['node', 'npm', 'yarn'].map(async tool => { |   const promises = ['node', 'npm', 'yarn'].map(async tool => { | ||||||
|     const output = await getToolVersion(tool, ['--version']); |     const pathTool = await io.which(tool, false); | ||||||
|  |     const output = pathTool ? await getToolVersion(tool, ['--version']) : ''; | ||||||
|  |  | ||||||
|     return {tool, output}; |     return {tool, output}; | ||||||
|   }); |   }); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user