mirror of
https://github.com/actions/setup-node
synced 2024-12-22 13:12:43 +00:00
Update build
This commit is contained in:
parent
9e956a555c
commit
5a8d9111e3
1 changed files with 56 additions and 34 deletions
32
dist/setup/index.js
vendored
32
dist/setup/index.js
vendored
|
@ -72783,8 +72783,9 @@ class OfficialBuilds extends base_distribution_1.default {
|
|||
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
||||
if (toolPath) {
|
||||
core.info(`Found in cache @ ${toolPath}`);
|
||||
this.addToolPath(toolPath);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
let downloadPath = '';
|
||||
try {
|
||||
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
||||
|
@ -72813,6 +72814,22 @@ class OfficialBuilds extends base_distribution_1.default {
|
|||
core.info('Falling back to download directly from Node');
|
||||
}
|
||||
if (!toolPath) {
|
||||
toolPath = yield this.downloadDirectlyFromNode();
|
||||
}
|
||||
if (this.osPlat != 'win32') {
|
||||
toolPath = path_1.default.join(toolPath, 'bin');
|
||||
}
|
||||
core.addPath(toolPath);
|
||||
});
|
||||
}
|
||||
addToolPath(toolPath) {
|
||||
if (this.osPlat != 'win32') {
|
||||
toolPath = path_1.default.join(toolPath, 'bin');
|
||||
}
|
||||
core.addPath(toolPath);
|
||||
}
|
||||
downloadDirectlyFromNode() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const nodeJsVersions = yield this.getNodeJsVersions();
|
||||
const versions = this.filterVersions(nodeJsVersions);
|
||||
const evaluatedVersion = this.evaluateVersions(versions);
|
||||
|
@ -72820,13 +72837,18 @@ class OfficialBuilds extends base_distribution_1.default {
|
|||
throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`);
|
||||
}
|
||||
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
||||
toolPath = yield this.downloadNodejs(toolName);
|
||||
try {
|
||||
const toolPath = yield this.downloadNodejs(toolName);
|
||||
return toolPath;
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof tc.HTTPError && error.httpStatusCode === 404) {
|
||||
core.info(`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 at https://nodejs.org/. ' +
|
||||
'To resolve this issue you may either fall back to the older version or try again later.');
|
||||
}
|
||||
if (this.osPlat != 'win32') {
|
||||
toolPath = path_1.default.join(toolPath, 'bin');
|
||||
throw error;
|
||||
}
|
||||
core.addPath(toolPath);
|
||||
});
|
||||
}
|
||||
evaluateVersions(versions) {
|
||||
|
|
Loading…
Reference in a new issue