mirror of
https://github.com/actions/setup-node.git
synced 2026-02-20 05:24:47 +08:00
Compare commits
3 Commits
f4884e4127
...
v4.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdca7365b2 | ||
|
|
22c0e7494f | ||
|
|
a7c2d9473e |
2
.licenses/npm/@actions/tool-cache.dep.yml
generated
2
.licenses/npm/@actions/tool-cache.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@actions/tool-cache"
|
name: "@actions/tool-cache"
|
||||||
version: 2.0.1
|
version: 2.0.2
|
||||||
type: npm
|
type: npm
|
||||||
summary: Actions tool-cache lib
|
summary: Actions tool-cache lib
|
||||||
homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache
|
homepage: https://github.com/actions/toolkit/tree/main/packages/tool-cache
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@protobuf-ts/plugin-framework"
|
name: "@protobuf-ts/plugin-framework"
|
||||||
version: 2.9.4
|
version: 2.9.5
|
||||||
type: npm
|
type: npm
|
||||||
summary: framework to create protoc plugins
|
summary: framework to create protoc plugins
|
||||||
homepage: https://github.com/timostamm/protobuf-ts
|
homepage: https://github.com/timostamm/protobuf-ts
|
||||||
|
|||||||
2
.licenses/npm/@protobuf-ts/plugin.dep.yml
generated
2
.licenses/npm/@protobuf-ts/plugin.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@protobuf-ts/plugin"
|
name: "@protobuf-ts/plugin"
|
||||||
version: 2.9.4
|
version: 2.9.5
|
||||||
type: npm
|
type: npm
|
||||||
summary: The protocol buffer compiler plugin "protobuf-ts" generates TypeScript, gRPC-web,
|
summary: The protocol buffer compiler plugin "protobuf-ts" generates TypeScript, gRPC-web,
|
||||||
Twirp, and more.
|
Twirp, and more.
|
||||||
|
|||||||
34
.licenses/npm/@protobuf-ts/protoc.dep.yml
generated
34
.licenses/npm/@protobuf-ts/protoc.dep.yml
generated
@@ -1,14 +1,14 @@
|
|||||||
---
|
---
|
||||||
name: "@protobuf-ts/protoc"
|
name: "@protobuf-ts/protoc"
|
||||||
version: 2.9.4
|
version: 2.9.5
|
||||||
type: npm
|
type: npm
|
||||||
summary: Installs the protocol buffer compiler "protoc" for you.
|
summary: Installs the protocol buffer compiler "protoc" for you.
|
||||||
homepage: https://github.com/timostamm/protobuf-ts
|
homepage: https://github.com/timostamm/protobuf-ts
|
||||||
license: apache-2.0
|
license: apache-2.0
|
||||||
licenses:
|
licenses:
|
||||||
- sources: LICENSE
|
- sources: Auto-generated Apache-2.0 license text
|
||||||
text: |2
|
text: |2
|
||||||
Apache License
|
Apache License
|
||||||
Version 2.0, January 2004
|
Version 2.0, January 2004
|
||||||
http://www.apache.org/licenses/
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
@@ -44,7 +44,6 @@ licenses:
|
|||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
Object form, made available under the License, as indicated by a
|
Object form, made available under the License, as indicated by a
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
@@ -76,7 +75,6 @@ licenses:
|
|||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
Work and such Derivative Works in Source or Object form.
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
@@ -107,7 +105,6 @@ licenses:
|
|||||||
(b) You must cause any modified files to carry prominent notices
|
(b) You must cause any modified files to carry prominent notices
|
||||||
stating that You changed the files; and
|
stating that You changed the files; and
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
that You distribute, all copyright, patent, trademark, and
|
||||||
attribution notices from the Source form of the Work,
|
attribution notices from the Source form of the Work,
|
||||||
excluding those notices that do not pertain to any part of
|
excluding those notices that do not pertain to any part of
|
||||||
@@ -182,4 +179,29 @@ licenses:
|
|||||||
defend, and hold each Contributor harmless for any liability
|
defend, and hold each Contributor harmless for any liability
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
of your accepting any such warranty or additional liability.
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
notices: []
|
notices: []
|
||||||
|
|||||||
2
.licenses/npm/@protobuf-ts/runtime-rpc.dep.yml
generated
2
.licenses/npm/@protobuf-ts/runtime-rpc.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@protobuf-ts/runtime-rpc"
|
name: "@protobuf-ts/runtime-rpc"
|
||||||
version: 2.9.4
|
version: 2.9.5
|
||||||
type: npm
|
type: npm
|
||||||
summary: Runtime library for RPC clients generated by the protoc plugin "protobuf-ts"
|
summary: Runtime library for RPC clients generated by the protoc plugin "protobuf-ts"
|
||||||
homepage: https://github.com/timostamm/protobuf-ts
|
homepage: https://github.com/timostamm/protobuf-ts
|
||||||
|
|||||||
2
.licenses/npm/@protobuf-ts/runtime.dep.yml
generated
2
.licenses/npm/@protobuf-ts/runtime.dep.yml
generated
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: "@protobuf-ts/runtime"
|
name: "@protobuf-ts/runtime"
|
||||||
version: 2.9.4
|
version: 2.9.5
|
||||||
type: npm
|
type: npm
|
||||||
summary: Runtime library for code generated by the protoc plugin "protobuf-ts"
|
summary: Runtime library for code generated by the protoc plugin "protobuf-ts"
|
||||||
homepage: https://github.com/timostamm/protobuf-ts
|
homepage: https://github.com/timostamm/protobuf-ts
|
||||||
|
|||||||
39
.licenses/npm/uuid-3.4.0.dep.yml
generated
39
.licenses/npm/uuid-3.4.0.dep.yml
generated
@@ -1,39 +0,0 @@
|
|||||||
---
|
|
||||||
name: uuid
|
|
||||||
version: 3.4.0
|
|
||||||
type: npm
|
|
||||||
summary: RFC4122 (v1, v4, and v5) UUIDs
|
|
||||||
homepage: https://github.com/uuidjs/uuid#readme
|
|
||||||
license: mit
|
|
||||||
licenses:
|
|
||||||
- sources: LICENSE.md
|
|
||||||
text: |
|
|
||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c) 2010-2016 Robert Kieffer and other contributors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
notices:
|
|
||||||
- sources: AUTHORS
|
|
||||||
text: |-
|
|
||||||
Robert Kieffer <robert@broofa.com>
|
|
||||||
Christoph Tavan <dev@tavan.de>
|
|
||||||
AJ ONeal <coolaj86@gmail.com>
|
|
||||||
Vincent Voyer <vincent@zeroload.net>
|
|
||||||
Roman Shtylman <shtylman@gmail.com>
|
|
||||||
14
README.md
14
README.md
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
# setup-node
|
# setup-node
|
||||||
|
|
||||||
[](https://github.com/actions/setup-node/actions/workflows/basic-validation.yml)
|
[](https://github.com/actions/setup-node/actions/workflows/basic-validation.yml)
|
||||||
@@ -77,10 +76,6 @@ See [action.yml](action.yml)
|
|||||||
# Set always-auth option in npmrc file.
|
# Set always-auth option in npmrc file.
|
||||||
# Default: ''
|
# Default: ''
|
||||||
always-auth: ''
|
always-auth: ''
|
||||||
|
|
||||||
# Optional mirror to download nodejs binaries from.
|
|
||||||
# Default: ''
|
|
||||||
mirror-url: ''
|
|
||||||
```
|
```
|
||||||
<!-- end usage -->
|
<!-- end usage -->
|
||||||
|
|
||||||
@@ -91,7 +86,7 @@ steps:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 22
|
node-version: 18
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
```
|
```
|
||||||
@@ -108,7 +103,7 @@ The `node-version` input supports the Semantic Versioning Specification, for mor
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
- Major versions: `20`, `22`
|
- 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`
|
||||||
@@ -168,7 +163,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
node: [ 18, 20, 22 ]
|
node: [ 14, 16, 18 ]
|
||||||
name: Node ${{ matrix.node }} sample
|
name: Node ${{ matrix.node }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -208,7 +203,6 @@ If the runner is not able to access github.com, any Nodejs versions requested du
|
|||||||
- [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm)
|
- [Publishing to npmjs and GPR with npm](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-npm)
|
||||||
- [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn)
|
- [Publishing to npmjs and GPR with yarn](docs/advanced-usage.md#publish-to-npmjs-and-gpr-with-yarn)
|
||||||
- [Using private packages](docs/advanced-usage.md#use-private-packages)
|
- [Using private packages](docs/advanced-usage.md#use-private-packages)
|
||||||
- [Using mirror-url)](https://github.com/aparnajyothi-y/setup-node/edit/add-mirror-url/docs/advanced-usage.md#node-mirrors-nodejs-version-mirrors)
|
|
||||||
|
|
||||||
## Recommended permissions
|
## Recommended permissions
|
||||||
|
|
||||||
@@ -230,5 +224,3 @@ Contributions are welcome! See [Contributor's Guide](docs/contributors.md)
|
|||||||
## Code of Conduct
|
## Code of Conduct
|
||||||
|
|
||||||
:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)
|
:wave: Be nice. See [our code of conduct](CODE_OF_CONDUCT.md)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import each from 'jest-each';
|
|||||||
import * as main from '../src/main';
|
import * as main from '../src/main';
|
||||||
import * as util from '../src/util';
|
import * as util from '../src/util';
|
||||||
import OfficialBuilds from '../src/distributions/official_builds/official_builds';
|
import OfficialBuilds from '../src/distributions/official_builds/official_builds';
|
||||||
import {validateMirrorURL} from '../src/util';
|
|
||||||
|
|
||||||
describe('main tests', () => {
|
describe('main tests', () => {
|
||||||
let inputs = {} as any;
|
let inputs = {} as any;
|
||||||
@@ -281,36 +280,4 @@ describe('main tests', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe('mirror-url parameter', () => {
|
|
||||||
beforeEach(() => {
|
|
||||||
inputs['mirror-url'] = 'https://custom-mirror-url.com';
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
delete inputs['mirror-url'];
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Read mirror-url if mirror-url is provided', async () => {
|
|
||||||
// Arrange
|
|
||||||
inputs['mirror-url'] = 'https://custom-mirror-url.com';
|
|
||||||
|
|
||||||
// Act
|
|
||||||
await main.run();
|
|
||||||
|
|
||||||
// Assert
|
|
||||||
expect(inputs['mirror-url']).toBeDefined();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw an error if mirror-url is empty', async () => {
|
|
||||||
// Arrange
|
|
||||||
inputs['mirror-url'] = ' ';
|
|
||||||
|
|
||||||
const logSpy = jest.spyOn(console, 'log').mockImplementation(() => {}); // Mock the log function
|
|
||||||
|
|
||||||
// Act & Assert
|
|
||||||
expect(() => validateMirrorURL(inputs['mirror-url'])).toThrow(
|
|
||||||
'Mirror URL is empty. Please provide a valid mirror URL.'
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import osm from 'os';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import * as main from '../src/main';
|
import * as main from '../src/main';
|
||||||
import * as auth from '../src/authutil';
|
import * as auth from '../src/authutil';
|
||||||
import isLtsAlias from '../src/distributions/official_builds/official_builds';
|
|
||||||
|
|
||||||
import OfficialBuilds from '../src/distributions/official_builds/official_builds';
|
import OfficialBuilds from '../src/distributions/official_builds/official_builds';
|
||||||
import {INodeVersion} from '../src/distributions/base-models';
|
import {INodeVersion} from '../src/distributions/base-models';
|
||||||
|
|
||||||
@@ -830,35 +828,4 @@ describe('setup-node', () => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
describe('mirror-url parameter', () => {
|
|
||||||
it('default if mirror url is not provided', async () => {
|
|
||||||
os.platform = 'linux';
|
|
||||||
os.arch = 'x64';
|
|
||||||
|
|
||||||
inputs['node-version'] = '11';
|
|
||||||
inputs['check-latest'] = 'true';
|
|
||||||
inputs['always-auth'] = false;
|
|
||||||
inputs['token'] = 'faketoken';
|
|
||||||
|
|
||||||
dlSpy.mockImplementation(async () => '/some/temp/path');
|
|
||||||
const toolPath = path.normalize('/cache/node/12.11.0/x64');
|
|
||||||
exSpy.mockImplementation(async () => '/some/other/temp/path');
|
|
||||||
cacheSpy.mockImplementation(async () => toolPath);
|
|
||||||
|
|
||||||
const dlmirrorSpy = jest.fn();
|
|
||||||
dlmirrorSpy.mockImplementation(async () => 'mocked-download-path');
|
|
||||||
await main.run();
|
|
||||||
|
|
||||||
const expPath = path.join(toolPath, 'bin');
|
|
||||||
|
|
||||||
expect(dlSpy).toHaveBeenCalled();
|
|
||||||
expect(exSpy).toHaveBeenCalled();
|
|
||||||
|
|
||||||
expect(logSpy).toHaveBeenCalledWith(
|
|
||||||
'Attempt to resolve the latest version from manifest...'
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(cnSpy).toHaveBeenCalledWith(`::add-path::${expPath}${osm.EOL}`);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,9 +16,6 @@ inputs:
|
|||||||
default: false
|
default: false
|
||||||
registry-url:
|
registry-url:
|
||||||
description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.'
|
description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.'
|
||||||
mirror-url:
|
|
||||||
description: 'Custom mirror URL to download Node.js'
|
|
||||||
required: false
|
|
||||||
scope:
|
scope:
|
||||||
description: 'Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).'
|
description: 'Optional scope for authenticating against scoped registries. Will fall back to the repository owner when using the GitHub Packages registry (https://npm.pkg.github.com/).'
|
||||||
token:
|
token:
|
||||||
|
|||||||
2851
dist/cache-save/index.js
vendored
2851
dist/cache-save/index.js
vendored
File diff suppressed because one or more lines are too long
3919
dist/setup/index.js
vendored
3919
dist/setup/index.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
## Working with lockfiles
|
## Working with lockfiles
|
||||||
|
|
||||||
All supported package managers recommend that you **always** commit the lockfile, although implementations vary doing so generally provides the following benefits:
|
All supported package managers recommend that you **always** commit the lockfile, although implementations vary doing so generally provides the following benefits:
|
||||||
@@ -78,10 +76,10 @@ When using the `package.json` input, the action will look for `volta.node` first
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0"
|
"node": ">=16.0.0"
|
||||||
},
|
},
|
||||||
"volta": {
|
"volta": {
|
||||||
"node": "22.0.0"
|
"node": "16.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -102,7 +100,7 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
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
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
- run: npm test
|
||||||
@@ -241,7 +239,7 @@ steps:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '14'
|
||||||
cache: 'yarn'
|
cache: 'yarn'
|
||||||
- run: yarn install --frozen-lockfile # optional, --immutable
|
- run: yarn install --frozen-lockfile # optional, --immutable
|
||||||
- run: yarn test
|
- run: yarn test
|
||||||
@@ -263,7 +261,7 @@ steps:
|
|||||||
version: 6.32.9
|
version: 6.32.9
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '14'
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
- run: pnpm install
|
- run: pnpm install
|
||||||
- run: pnpm test
|
- run: pnpm test
|
||||||
@@ -279,7 +277,7 @@ steps:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '14'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: '**/package-lock.json'
|
cache-dependency-path: '**/package-lock.json'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
@@ -292,7 +290,7 @@ steps:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '14'
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
cache-dependency-path: |
|
cache-dependency-path: |
|
||||||
server/app/package-lock.json
|
server/app/package-lock.json
|
||||||
@@ -314,9 +312,9 @@ jobs:
|
|||||||
- macos-latest
|
- macos-latest
|
||||||
- windows-latest
|
- windows-latest
|
||||||
node_version:
|
node_version:
|
||||||
- 18
|
- 12
|
||||||
- 20
|
- 14
|
||||||
- 22
|
- 16
|
||||||
architecture:
|
architecture:
|
||||||
- x64
|
- x64
|
||||||
# an extra windows-x86 run:
|
# an extra windows-x86 run:
|
||||||
@@ -342,7 +340,7 @@ steps:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '14.x'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm publish
|
- run: npm publish
|
||||||
@@ -362,7 +360,7 @@ steps:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '14.x'
|
||||||
registry-url: <registry url>
|
registry-url: <registry url>
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
- run: yarn publish
|
- run: yarn publish
|
||||||
@@ -382,7 +380,7 @@ steps:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '22'
|
node-version: '14.x'
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
# Skip post-install scripts here, as a malicious
|
# Skip post-install scripts here, as a malicious
|
||||||
# script could steal NODE_AUTH_TOKEN.
|
# script could steal NODE_AUTH_TOKEN.
|
||||||
@@ -420,15 +418,3 @@ Please refer to the [Ensuring workflow access to your package - Configuring a pa
|
|||||||
|
|
||||||
### always-auth input
|
### always-auth input
|
||||||
The always-auth input sets `always-auth=true` in .npmrc file. With this option set [npm](https://docs.npmjs.com/cli/v6/using-npm/config#always-auth)/yarn sends the authentication credentials when making a request to the registries.
|
The always-auth input sets `always-auth=true` in .npmrc file. With this option set [npm](https://docs.npmjs.com/cli/v6/using-npm/config#always-auth)/yarn sends the authentication credentials when making a request to the registries.
|
||||||
|
|
||||||
### Using mirror-url
|
|
||||||
You can use the new mirror-url parameter to specify a custom mirror for downloading node.js versions from a different location
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '22'
|
|
||||||
mirror-url: 'https://mirror.example.com/node'
|
|
||||||
```
|
|
||||||
74
package-lock.json
generated
74
package-lock.json
generated
@@ -16,7 +16,7 @@
|
|||||||
"@actions/glob": "^0.5.0",
|
"@actions/glob": "^0.5.0",
|
||||||
"@actions/http-client": "^2.2.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.2",
|
||||||
"semver": "^7.6.3",
|
"semver": "^7.6.3",
|
||||||
"uuid": "^9.0.1"
|
"uuid": "^9.0.1"
|
||||||
},
|
},
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
"@types/semver": "^7.5.8",
|
"@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.3",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
"eslint-plugin-jest": "^27.9.0",
|
"eslint-plugin-jest": "^27.9.0",
|
||||||
@@ -138,16 +138,16 @@
|
|||||||
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
|
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
|
||||||
},
|
},
|
||||||
"node_modules/@actions/tool-cache": {
|
"node_modules/@actions/tool-cache": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-2.0.2.tgz",
|
||||||
"integrity": "sha512-iPU+mNwrbA8jodY8eyo/0S/QqCKDajiR8OxWTnSk/SnYg0sj8Hp4QcUEVC1YFpHWXtrfbQrE13Jz4k4HXJQKcA==",
|
"integrity": "sha512-fBhNNOWxuoLxztQebpOaWu6WeVmuwa77Z+DxIZ1B+OYvGkGQon6kTVg6Z32Cb13WCuw0szqonK+hh03mJV7Z6w==",
|
||||||
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.2.6",
|
"@actions/core": "^1.11.1",
|
||||||
"@actions/exec": "^1.0.0",
|
"@actions/exec": "^1.0.0",
|
||||||
"@actions/http-client": "^2.0.1",
|
"@actions/http-client": "^2.0.1",
|
||||||
"@actions/io": "^1.1.1",
|
"@actions/io": "^1.1.1",
|
||||||
"semver": "^6.1.0",
|
"semver": "^6.1.0"
|
||||||
"uuid": "^3.3.2"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/tool-cache/node_modules/semver": {
|
"node_modules/@actions/tool-cache/node_modules/semver": {
|
||||||
@@ -158,15 +158,6 @@
|
|||||||
"semver": "bin/semver.js"
|
"semver": "bin/semver.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@actions/tool-cache/node_modules/uuid": {
|
|
||||||
"version": "3.4.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
|
||||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
|
||||||
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
|
|
||||||
"bin": {
|
|
||||||
"uuid": "bin/uuid"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@ampproject/remapping": {
|
"node_modules/@ampproject/remapping": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz",
|
||||||
@@ -1681,15 +1672,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@protobuf-ts/plugin": {
|
"node_modules/@protobuf-ts/plugin": {
|
||||||
"version": "2.9.4",
|
"version": "2.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin/-/plugin-2.9.5.tgz",
|
||||||
"integrity": "sha512-Db5Laq5T3mc6ERZvhIhkj1rn57/p8gbWiCKxQWbZBBl20wMuqKoHbRw4tuD7FyXi+IkwTToaNVXymv5CY3E8Rw==",
|
"integrity": "sha512-KCzNRTFye837XdfPjS85gGzxgPGVDR3W8Px2G3etXuouNog9W+Cr+U0IBTFADrRWXC2x+OSNjXxrdZEiw+H5Cw==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@protobuf-ts/plugin-framework": "^2.9.4",
|
"@protobuf-ts/plugin-framework": "^2.9.5",
|
||||||
"@protobuf-ts/protoc": "^2.9.4",
|
"@protobuf-ts/protoc": "^2.9.5",
|
||||||
"@protobuf-ts/runtime": "^2.9.4",
|
"@protobuf-ts/runtime": "^2.9.5",
|
||||||
"@protobuf-ts/runtime-rpc": "^2.9.4",
|
"@protobuf-ts/runtime-rpc": "^2.9.5",
|
||||||
"typescript": "^3.9"
|
"typescript": "^3.9"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -1698,12 +1689,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@protobuf-ts/plugin-framework": {
|
"node_modules/@protobuf-ts/plugin-framework": {
|
||||||
"version": "2.9.4",
|
"version": "2.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/plugin-framework/-/plugin-framework-2.9.5.tgz",
|
||||||
"integrity": "sha512-9nuX1kjdMliv+Pes8dQCKyVhjKgNNfwxVHg+tx3fLXSfZZRcUHMc1PMwB9/vTvc6gBKt9QGz5ERqSqZc0++E9A==",
|
"integrity": "sha512-DYNQ8Ga3xwPZMfaZGRCnDOcEdQZK9MorTXngVoFLnHWEE8zLhUjFVtdkChZtTih6rl8Z6akyA7hRgj/GrJF58Q==",
|
||||||
"license": "(Apache-2.0 AND BSD-3-Clause)",
|
"license": "(Apache-2.0 AND BSD-3-Clause)",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@protobuf-ts/runtime": "^2.9.4",
|
"@protobuf-ts/runtime": "^2.9.5",
|
||||||
"typescript": "^3.9"
|
"typescript": "^3.9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1734,27 +1725,27 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@protobuf-ts/protoc": {
|
"node_modules/@protobuf-ts/protoc": {
|
||||||
"version": "2.9.4",
|
"version": "2.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/protoc/-/protoc-2.9.5.tgz",
|
||||||
"integrity": "sha512-hQX+nOhFtrA+YdAXsXEDrLoGJqXHpgv4+BueYF0S9hy/Jq0VRTVlJS1Etmf4qlMt/WdigEes5LOd/LDzui4GIQ==",
|
"integrity": "sha512-n6a7OHfr/Ubw483L6kNJB0wBCe/Ops0A652zB6J6nR2x1o+pjVFrMCeeQQsqxkYpQwQ8FCIETSxrMpfOBKTIvQ==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bin": {
|
"bin": {
|
||||||
"protoc": "protoc.js"
|
"protoc": "protoc.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@protobuf-ts/runtime": {
|
"node_modules/@protobuf-ts/runtime": {
|
||||||
"version": "2.9.4",
|
"version": "2.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime/-/runtime-2.9.5.tgz",
|
||||||
"integrity": "sha512-vHRFWtJJB/SiogWDF0ypoKfRIZ41Kq+G9cEFj6Qm1eQaAhJ1LDFvgZ7Ja4tb3iLOQhz0PaoPnnOijF1qmEqTxg==",
|
"integrity": "sha512-SsumigRe3IqNTCQvVZUqDQExsKF72eyAMiWlYb5Jwj3eU4z8UH7JLlSfb/Wjidz4b/chTN6zh5AXBSKl0Asm3A==",
|
||||||
"license": "(Apache-2.0 AND BSD-3-Clause)"
|
"license": "(Apache-2.0 AND BSD-3-Clause)"
|
||||||
},
|
},
|
||||||
"node_modules/@protobuf-ts/runtime-rpc": {
|
"node_modules/@protobuf-ts/runtime-rpc": {
|
||||||
"version": "2.9.4",
|
"version": "2.9.5",
|
||||||
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.4.tgz",
|
"resolved": "https://registry.npmjs.org/@protobuf-ts/runtime-rpc/-/runtime-rpc-2.9.5.tgz",
|
||||||
"integrity": "sha512-y9L9JgnZxXFqH5vD4d7j9duWvIJ7AShyBRoNKJGhu9Q27qIbchfzli66H9RvrQNIFk5ER7z1Twe059WZGqERcA==",
|
"integrity": "sha512-NWAb1TaV4CR+BknZr1WRVT5Ws2AupVwGgRNes4oPAFrgLNXQotDFl2E6pmsjPwME8sAgJVzeSr7bUqQVyoAK2A==",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@protobuf-ts/runtime": "^2.9.4"
|
"@protobuf-ts/runtime": "^2.9.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@sinclair/typebox": {
|
"node_modules/@sinclair/typebox": {
|
||||||
@@ -2132,10 +2123,11 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@vercel/ncc": {
|
"node_modules/@vercel/ncc": {
|
||||||
"version": "0.38.1",
|
"version": "0.38.3",
|
||||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.1.tgz",
|
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.3.tgz",
|
||||||
"integrity": "sha512-IBBb+iI2NLu4VQn3Vwldyi2QwaXt5+hTyh58ggAMoCGE6DJmPvwL3KPBWcJl1m9LYPChBLE980Jw+CS4Wokqxw==",
|
"integrity": "sha512-rnK6hJBS6mwc+Bkab+PGPs9OiS0i/3kdTO+CkI8V0/VrW3vmz7O2Pxjw/owOlmo6PKEIxRSeZKv/kuL9itnpYA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
"bin": {
|
"bin": {
|
||||||
"ncc": "dist/ncc/cli.js"
|
"ncc": "dist/ncc/cli.js"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
"@actions/glob": "^0.5.0",
|
"@actions/glob": "^0.5.0",
|
||||||
"@actions/http-client": "^2.2.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.2",
|
||||||
"semver": "^7.6.3",
|
"semver": "^7.6.3",
|
||||||
"uuid": "^9.0.1"
|
"uuid": "^9.0.1"
|
||||||
},
|
},
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
"@types/semver": "^7.5.8",
|
"@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.3",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-config-prettier": "^8.6.0",
|
"eslint-config-prettier": "^8.6.0",
|
||||||
"eslint-plugin-jest": "^27.9.0",
|
"eslint-plugin-jest": "^27.9.0",
|
||||||
|
|||||||
@@ -104,34 +104,6 @@ export default abstract class BaseDistribution {
|
|||||||
return response.result || [];
|
return response.result || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async getMirrorUrlVersions(): Promise<INodeVersion[]> {
|
|
||||||
const initialUrl = this.getDistributionUrl();
|
|
||||||
|
|
||||||
const dataUrl = `${initialUrl}/index.json`;
|
|
||||||
try {
|
|
||||||
const response = await this.httpClient.getJson<INodeVersion[]>(dataUrl);
|
|
||||||
return response.result || [];
|
|
||||||
} catch (err) {
|
|
||||||
if (
|
|
||||||
err instanceof Error &&
|
|
||||||
err.message.includes('getaddrinfo EAI_AGAIN')
|
|
||||||
) {
|
|
||||||
core.setFailed(
|
|
||||||
`Network error: Failed to resolve the server at ${dataUrl}.Please check your DNS settings or verify that the URL is correct.`
|
|
||||||
);
|
|
||||||
} else if (err instanceof hc.HttpClientError && err.statusCode === 404) {
|
|
||||||
core.setFailed(
|
|
||||||
`404 Error: Unable to find versions at ${dataUrl}.Please verify that the mirror URL is valid.`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
core.setFailed(
|
|
||||||
`Failed to fetch Node.js versions from ${dataUrl}.Please check the URL and try again.}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected getNodejsDistInfo(version: string) {
|
protected getNodejsDistInfo(version: string) {
|
||||||
const osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch);
|
const osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||||
version = semver.clean(version) || '';
|
version = semver.clean(version) || '';
|
||||||
@@ -156,33 +128,6 @@ export default abstract class BaseDistribution {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getNodejsMirrorURLInfo(version: string) {
|
|
||||||
const mirrorURL = this.nodeInfo.mirrorURL;
|
|
||||||
|
|
||||||
const osArch: string = this.translateArchToDistUrl(this.nodeInfo.arch);
|
|
||||||
|
|
||||||
version = semver.clean(version) || '';
|
|
||||||
const fileName: string =
|
|
||||||
this.osPlat == 'win32'
|
|
||||||
? `node-v${version}-win-${osArch}`
|
|
||||||
: `node-v${version}-${this.osPlat}-${osArch}`;
|
|
||||||
const urlFileName: string =
|
|
||||||
this.osPlat == 'win32'
|
|
||||||
? this.nodeInfo.arch === 'arm64'
|
|
||||||
? `${fileName}.zip`
|
|
||||||
: `${fileName}.7z`
|
|
||||||
: `${fileName}.tar.gz`;
|
|
||||||
|
|
||||||
const url = `${mirrorURL}/v${version}/${urlFileName}`;
|
|
||||||
|
|
||||||
return <INodeVersionInfo>{
|
|
||||||
downloadUrl: url,
|
|
||||||
resolvedVersion: version,
|
|
||||||
arch: osArch,
|
|
||||||
fileName: fileName
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async downloadNodejs(info: INodeVersionInfo) {
|
protected async downloadNodejs(info: INodeVersionInfo) {
|
||||||
let downloadPath = '';
|
let downloadPath = '';
|
||||||
core.info(
|
core.info(
|
||||||
@@ -198,23 +143,9 @@ export default abstract class BaseDistribution {
|
|||||||
) {
|
) {
|
||||||
return await this.acquireWindowsNodeFromFallbackLocation(
|
return await this.acquireWindowsNodeFromFallbackLocation(
|
||||||
info.resolvedVersion,
|
info.resolvedVersion,
|
||||||
info.arch,
|
info.arch
|
||||||
info.downloadUrl
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// Handle network-related issues (e.g., DNS resolution failures)
|
|
||||||
if (
|
|
||||||
err instanceof Error &&
|
|
||||||
err.message.includes('getaddrinfo EAI_AGAIN')
|
|
||||||
) {
|
|
||||||
core.error(
|
|
||||||
`Network error: Failed to resolve the server at ${info.downloadUrl}.
|
|
||||||
This could be due to a DNS resolution issue. Please verify the URL or check your network connection.`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
core.error(
|
|
||||||
`Download failed from ${info.downloadUrl}. Please check the URl and try again.`
|
|
||||||
);
|
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
@@ -235,11 +166,9 @@ export default abstract class BaseDistribution {
|
|||||||
|
|
||||||
protected async acquireWindowsNodeFromFallbackLocation(
|
protected async acquireWindowsNodeFromFallbackLocation(
|
||||||
version: string,
|
version: string,
|
||||||
arch: string = os.arch(),
|
arch: string = os.arch()
|
||||||
downloadUrl: string
|
|
||||||
): Promise<string> {
|
): Promise<string> {
|
||||||
const initialUrl = this.getDistributionUrl();
|
const initialUrl = this.getDistributionUrl();
|
||||||
core.info('url: ' + initialUrl);
|
|
||||||
const osArch: string = this.translateArchToDistUrl(arch);
|
const osArch: string = this.translateArchToDistUrl(arch);
|
||||||
|
|
||||||
// Create temporary folder to download to
|
// Create temporary folder to download to
|
||||||
@@ -256,12 +185,6 @@ export default abstract class BaseDistribution {
|
|||||||
|
|
||||||
core.info(`Downloading only node binary from ${exeUrl}`);
|
core.info(`Downloading only node binary from ${exeUrl}`);
|
||||||
|
|
||||||
if (downloadUrl != exeUrl) {
|
|
||||||
core.error(
|
|
||||||
'unable to download node binary with the provided URL. Please check and try again'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const exePath = await tc.downloadTool(exeUrl);
|
const exePath = await tc.downloadTool(exeUrl);
|
||||||
await io.cp(exePath, path.join(tempDir, 'node.exe'));
|
await io.cp(exePath, path.join(tempDir, 'node.exe'));
|
||||||
const libPath = await tc.downloadTool(libUrl);
|
const libPath = await tc.downloadTool(libUrl);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ export interface NodeInputs {
|
|||||||
auth?: string;
|
auth?: string;
|
||||||
checkLatest: boolean;
|
checkLatest: boolean;
|
||||||
stable: boolean;
|
stable: boolean;
|
||||||
mirrorURL?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface INodeVersionInfo {
|
export interface INodeVersionInfo {
|
||||||
|
|||||||
@@ -3,16 +3,11 @@ import {NodeInputs} from '../base-models';
|
|||||||
|
|
||||||
export default class NightlyNodejs extends BasePrereleaseNodejs {
|
export default class NightlyNodejs extends BasePrereleaseNodejs {
|
||||||
protected distribution = 'nightly';
|
protected distribution = 'nightly';
|
||||||
|
|
||||||
constructor(nodeInfo: NodeInputs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getDistributionUrl(): string {
|
protected getDistributionUrl(): string {
|
||||||
if (this.nodeInfo.mirrorURL) {
|
return 'https://nodejs.org/download/nightly';
|
||||||
return this.nodeInfo.mirrorURL;
|
|
||||||
} else {
|
|
||||||
return 'https://nodejs.org/download/nightly';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,125 +15,115 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async setupNodeJs() {
|
public async setupNodeJs() {
|
||||||
if (this.nodeInfo.mirrorURL) {
|
let manifest: tc.IToolRelease[] | undefined;
|
||||||
try {
|
let nodeJsVersions: INodeVersion[] | undefined;
|
||||||
core.info(`Attempting to download using mirror URL...`);
|
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
||||||
await this.downloadFromMirrorURL(); // Attempt to download from the mirror
|
|
||||||
} catch (err) {
|
|
||||||
core.setFailed((err as Error).message);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
core.info('Setup Node.js');
|
|
||||||
let manifest: tc.IToolRelease[] | undefined;
|
|
||||||
let nodeJsVersions: INodeVersion[] | undefined;
|
|
||||||
const osArch = this.translateArchToDistUrl(this.nodeInfo.arch);
|
|
||||||
|
|
||||||
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
if (this.isLtsAlias(this.nodeInfo.versionSpec)) {
|
||||||
core.info('Attempt to resolve LTS alias from manifest...');
|
core.info('Attempt to resolve LTS alias from manifest...');
|
||||||
|
|
||||||
// No try-catch since it's not possible to resolve LTS alias without manifest
|
// No try-catch since it's not possible to resolve LTS alias without manifest
|
||||||
manifest = await this.getManifest();
|
manifest = await this.getManifest();
|
||||||
|
|
||||||
this.nodeInfo.versionSpec = this.resolveLtsAliasFromManifest(
|
this.nodeInfo.versionSpec = this.resolveLtsAliasFromManifest(
|
||||||
this.nodeInfo.versionSpec,
|
this.nodeInfo.versionSpec,
|
||||||
this.nodeInfo.stable,
|
this.nodeInfo.stable,
|
||||||
manifest
|
manifest
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
|
|
||||||
nodeJsVersions = await this.getNodeJsVersions();
|
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
|
||||||
this.nodeInfo.versionSpec = this.evaluateVersions(versions);
|
|
||||||
|
|
||||||
core.info('getting latest node version...');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.nodeInfo.checkLatest) {
|
|
||||||
core.info('Attempt to resolve the latest version from manifest...');
|
|
||||||
const resolvedVersion = await this.resolveVersionFromManifest(
|
|
||||||
this.nodeInfo.versionSpec,
|
|
||||||
this.nodeInfo.stable,
|
|
||||||
osArch,
|
|
||||||
manifest
|
|
||||||
);
|
|
||||||
if (resolvedVersion) {
|
|
||||||
this.nodeInfo.versionSpec = resolvedVersion;
|
|
||||||
core.info(`Resolved as '${resolvedVersion}'`);
|
|
||||||
} else {
|
|
||||||
core.info(
|
|
||||||
`Failed to resolve version ${this.nodeInfo.versionSpec} from manifest`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
|
||||||
|
|
||||||
if (toolPath) {
|
|
||||||
core.info(`Found in cache @ ${toolPath}`);
|
|
||||||
this.addToolPath(toolPath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let downloadPath = '';
|
|
||||||
try {
|
|
||||||
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
|
||||||
|
|
||||||
const versionInfo = await this.getInfoFromManifest(
|
|
||||||
this.nodeInfo.versionSpec,
|
|
||||||
this.nodeInfo.stable,
|
|
||||||
osArch,
|
|
||||||
manifest
|
|
||||||
);
|
|
||||||
|
|
||||||
if (versionInfo) {
|
|
||||||
core.info(
|
|
||||||
`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`
|
|
||||||
);
|
|
||||||
downloadPath = await tc.downloadTool(
|
|
||||||
versionInfo.downloadUrl,
|
|
||||||
undefined,
|
|
||||||
this.nodeInfo.auth
|
|
||||||
);
|
|
||||||
|
|
||||||
if (downloadPath) {
|
|
||||||
toolPath = await this.extractArchive(
|
|
||||||
downloadPath,
|
|
||||||
versionInfo,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
core.info(
|
|
||||||
'Not found in manifest. Falling back to download directly from Node'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
// Rate limit?
|
|
||||||
if (
|
|
||||||
err instanceof tc.HTTPError &&
|
|
||||||
(err.httpStatusCode === 403 || err.httpStatusCode === 429)
|
|
||||||
) {
|
|
||||||
core.info(
|
|
||||||
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
core.info((err as Error).message);
|
|
||||||
}
|
|
||||||
core.debug((err as Error).stack ?? 'empty stack');
|
|
||||||
core.info('Falling back to download directly from Node');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!toolPath) {
|
|
||||||
toolPath = await this.downloadDirectlyFromNode();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.osPlat != 'win32') {
|
|
||||||
toolPath = path.join(toolPath, 'bin');
|
|
||||||
}
|
|
||||||
|
|
||||||
core.addPath(toolPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
|
||||||
|
nodeJsVersions = await this.getNodeJsVersions();
|
||||||
|
const versions = this.filterVersions(nodeJsVersions);
|
||||||
|
this.nodeInfo.versionSpec = this.evaluateVersions(versions);
|
||||||
|
|
||||||
|
core.info('getting latest node version...');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.nodeInfo.checkLatest) {
|
||||||
|
core.info('Attempt to resolve the latest version from manifest...');
|
||||||
|
const resolvedVersion = await this.resolveVersionFromManifest(
|
||||||
|
this.nodeInfo.versionSpec,
|
||||||
|
this.nodeInfo.stable,
|
||||||
|
osArch,
|
||||||
|
manifest
|
||||||
|
);
|
||||||
|
if (resolvedVersion) {
|
||||||
|
this.nodeInfo.versionSpec = resolvedVersion;
|
||||||
|
core.info(`Resolved as '${resolvedVersion}'`);
|
||||||
|
} else {
|
||||||
|
core.info(
|
||||||
|
`Failed to resolve version ${this.nodeInfo.versionSpec} from manifest`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
||||||
|
|
||||||
|
if (toolPath) {
|
||||||
|
core.info(`Found in cache @ ${toolPath}`);
|
||||||
|
this.addToolPath(toolPath);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let downloadPath = '';
|
||||||
|
try {
|
||||||
|
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
||||||
|
|
||||||
|
const versionInfo = await this.getInfoFromManifest(
|
||||||
|
this.nodeInfo.versionSpec,
|
||||||
|
this.nodeInfo.stable,
|
||||||
|
osArch,
|
||||||
|
manifest
|
||||||
|
);
|
||||||
|
|
||||||
|
if (versionInfo) {
|
||||||
|
core.info(
|
||||||
|
`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`
|
||||||
|
);
|
||||||
|
downloadPath = await tc.downloadTool(
|
||||||
|
versionInfo.downloadUrl,
|
||||||
|
undefined,
|
||||||
|
this.nodeInfo.auth
|
||||||
|
);
|
||||||
|
|
||||||
|
if (downloadPath) {
|
||||||
|
toolPath = await this.extractArchive(
|
||||||
|
downloadPath,
|
||||||
|
versionInfo,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
core.info(
|
||||||
|
'Not found in manifest. Falling back to download directly from Node'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
// Rate limit?
|
||||||
|
if (
|
||||||
|
err instanceof tc.HTTPError &&
|
||||||
|
(err.httpStatusCode === 403 || err.httpStatusCode === 429)
|
||||||
|
) {
|
||||||
|
core.info(
|
||||||
|
`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
core.info((err as Error).message);
|
||||||
|
}
|
||||||
|
core.debug((err as Error).stack ?? 'empty stack');
|
||||||
|
core.info('Falling back to download directly from Node');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!toolPath) {
|
||||||
|
toolPath = await this.downloadDirectlyFromNode();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.osPlat != 'win32') {
|
||||||
|
toolPath = path.join(toolPath, 'bin');
|
||||||
|
}
|
||||||
|
|
||||||
|
core.addPath(toolPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected addToolPath(toolPath: string) {
|
protected addToolPath(toolPath: string) {
|
||||||
@@ -187,9 +177,6 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected getDistributionUrl(): string {
|
protected getDistributionUrl(): string {
|
||||||
if (this.nodeInfo.mirrorURL) {
|
|
||||||
return this.nodeInfo.mirrorURL;
|
|
||||||
}
|
|
||||||
return `https://nodejs.org/dist`;
|
return `https://nodejs.org/dist`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,39 +291,4 @@ export default class OfficialBuilds extends BaseDistribution {
|
|||||||
private isLatestSyntax(versionSpec): boolean {
|
private isLatestSyntax(versionSpec): boolean {
|
||||||
return ['current', 'latest', 'node'].includes(versionSpec);
|
return ['current', 'latest', 'node'].includes(versionSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected async downloadFromMirrorURL() {
|
|
||||||
const nodeJsVersions = await this.getMirrorUrlVersions();
|
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
|
||||||
|
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
|
||||||
|
|
||||||
if (!evaluatedVersion) {
|
|
||||||
throw new Error(
|
|
||||||
`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch} from the provided mirror-url ${this.nodeInfo.mirrorURL}. Please check the mirror-url`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const toolName = this.getNodejsMirrorURLInfo(evaluatedVersion);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const toolPath = await this.downloadNodejs(toolName);
|
|
||||||
|
|
||||||
return toolPath;
|
|
||||||
} catch (error) {
|
|
||||||
if (error instanceof tc.HTTPError && error.httpStatusCode === 404) {
|
|
||||||
core.setFailed(
|
|
||||||
`Node version ${this.nodeInfo.versionSpec} for platform ${this.osPlat} and architecture ${this.nodeInfo.arch} was found but failed to download. ` +
|
|
||||||
'This usually happens when downloadable binaries are not fully updated in the provided mirror-url' +
|
|
||||||
'To resolve this issue you may either fall back to the older version or try again later.'
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
core.setFailed(
|
|
||||||
`An unexpected error occurred like url might not correct`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,11 +5,8 @@ export default class RcBuild extends BaseDistribution {
|
|||||||
constructor(nodeInfo: NodeInputs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
super(nodeInfo);
|
super(nodeInfo);
|
||||||
}
|
}
|
||||||
protected getDistributionUrl(): string {
|
|
||||||
if (this.nodeInfo.mirrorURL) {
|
getDistributionUrl(): string {
|
||||||
return this.nodeInfo.mirrorURL;
|
return 'https://nodejs.org/download/rc';
|
||||||
} else {
|
|
||||||
return 'https://nodejs.org/download/rc';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
import BasePrereleaseNodejs from '../base-distribution-prerelease';
|
||||||
import {NodeInputs} from '../base-models';
|
import {NodeInputs} from '../base-models';
|
||||||
|
|
||||||
export default class CanaryBuild extends BasePrereleaseNodejs {
|
export default class CanaryBuild extends BasePrereleaseNodejs {
|
||||||
protected distribution = 'v8-canary';
|
protected distribution = 'v8-canary';
|
||||||
constructor(nodeInfo: NodeInputs) {
|
constructor(nodeInfo: NodeInputs) {
|
||||||
@@ -7,10 +8,6 @@ export default class CanaryBuild extends BasePrereleaseNodejs {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected getDistributionUrl(): string {
|
protected getDistributionUrl(): string {
|
||||||
if (this.nodeInfo.mirrorURL) {
|
return 'https://nodejs.org/download/v8-canary';
|
||||||
return this.nodeInfo.mirrorURL;
|
|
||||||
} else {
|
|
||||||
return 'https://nodejs.org/download/v8-canary';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ export async function run() {
|
|||||||
arch = os.arch();
|
arch = os.arch();
|
||||||
}
|
}
|
||||||
|
|
||||||
const mirrorURL = core.getInput('mirror-url');
|
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
const token = core.getInput('token');
|
const token = core.getInput('token');
|
||||||
const auth = !token ? undefined : `token ${token}`;
|
const auth = !token ? undefined : `token ${token}`;
|
||||||
@@ -47,8 +45,7 @@ export async function run() {
|
|||||||
checkLatest,
|
checkLatest,
|
||||||
auth,
|
auth,
|
||||||
stable,
|
stable,
|
||||||
arch,
|
arch
|
||||||
mirrorURL
|
|
||||||
};
|
};
|
||||||
const nodeDistribution = getNodejsDistribution(nodejsInfo);
|
const nodeDistribution = getNodejsDistribution(nodejsInfo);
|
||||||
await nodeDistribution.setupNodeJs();
|
await nodeDistribution.setupNodeJs();
|
||||||
|
|||||||
@@ -97,13 +97,7 @@ async function getToolVersion(tool: string, options: string[]) {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function validateMirrorURL(mirrorURL) {
|
|
||||||
if (mirrorURL === ' ' || mirrorURL.trim() === 'undefined') {
|
|
||||||
throw new Error('Mirror URL is empty. Please provide a valid mirror URL.');
|
|
||||||
} else {
|
|
||||||
return mirrorURL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
export const unique = () => {
|
export const unique = () => {
|
||||||
const encountered = new Set();
|
const encountered = new Set();
|
||||||
return (value: unknown): boolean => {
|
return (value: unknown): boolean => {
|
||||||
|
|||||||
Reference in New Issue
Block a user