mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2024-12-25 03:55:50 +00:00
Update build
This commit is contained in:
parent
9e956a555c
commit
5a8d9111e3
1 changed files with 56 additions and 34 deletions
90
dist/setup/index.js
vendored
90
dist/setup/index.js
vendored
|
@ -72783,45 +72783,38 @@ class OfficialBuilds extends base_distribution_1.default {
|
||||||
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
let toolPath = this.findVersionInHostedToolCacheDirectory();
|
||||||
if (toolPath) {
|
if (toolPath) {
|
||||||
core.info(`Found in cache @ ${toolPath}`);
|
core.info(`Found in cache @ ${toolPath}`);
|
||||||
|
this.addToolPath(toolPath);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else {
|
let downloadPath = '';
|
||||||
let downloadPath = '';
|
try {
|
||||||
try {
|
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
||||||
core.info(`Attempting to download ${this.nodeInfo.versionSpec}...`);
|
const versionInfo = yield this.getInfoFromManifest(this.nodeInfo.versionSpec, this.nodeInfo.stable, osArch, manifest);
|
||||||
const versionInfo = yield this.getInfoFromManifest(this.nodeInfo.versionSpec, this.nodeInfo.stable, osArch, manifest);
|
if (versionInfo) {
|
||||||
if (versionInfo) {
|
core.info(`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`);
|
||||||
core.info(`Acquiring ${versionInfo.resolvedVersion} - ${versionInfo.arch} from ${versionInfo.downloadUrl}`);
|
downloadPath = yield tc.downloadTool(versionInfo.downloadUrl, undefined, this.nodeInfo.auth);
|
||||||
downloadPath = yield tc.downloadTool(versionInfo.downloadUrl, undefined, this.nodeInfo.auth);
|
if (downloadPath) {
|
||||||
if (downloadPath) {
|
toolPath = yield this.extractArchive(downloadPath, versionInfo);
|
||||||
toolPath = yield this.extractArchive(downloadPath, versionInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core.info('Not found in manifest. Falling back to download directly from Node');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (err) {
|
else {
|
||||||
// Rate limit?
|
core.info('Not found in manifest. Falling back to download directly from Node');
|
||||||
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.message);
|
|
||||||
}
|
|
||||||
core.debug((_a = err.stack) !== null && _a !== void 0 ? _a : 'empty stack');
|
|
||||||
core.info('Falling back to download directly from Node');
|
|
||||||
}
|
}
|
||||||
if (!toolPath) {
|
}
|
||||||
const nodeJsVersions = yield this.getNodeJsVersions();
|
catch (err) {
|
||||||
const versions = this.filterVersions(nodeJsVersions);
|
// Rate limit?
|
||||||
const evaluatedVersion = this.evaluateVersions(versions);
|
if (err instanceof tc.HTTPError &&
|
||||||
if (!evaluatedVersion) {
|
(err.httpStatusCode === 403 || err.httpStatusCode === 429)) {
|
||||||
throw new Error(`Unable to find Node version '${this.nodeInfo.versionSpec}' for platform ${this.osPlat} and architecture ${this.nodeInfo.arch}.`);
|
core.info(`Received HTTP status code ${err.httpStatusCode}. This usually indicates the rate limit has been exceeded`);
|
||||||
}
|
|
||||||
const toolName = this.getNodejsDistInfo(evaluatedVersion);
|
|
||||||
toolPath = yield this.downloadNodejs(toolName);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
core.info(err.message);
|
||||||
|
}
|
||||||
|
core.debug((_a = err.stack) !== null && _a !== void 0 ? _a : 'empty stack');
|
||||||
|
core.info('Falling back to download directly from Node');
|
||||||
|
}
|
||||||
|
if (!toolPath) {
|
||||||
|
toolPath = yield this.downloadDirectlyFromNode();
|
||||||
}
|
}
|
||||||
if (this.osPlat != 'win32') {
|
if (this.osPlat != 'win32') {
|
||||||
toolPath = path_1.default.join(toolPath, 'bin');
|
toolPath = path_1.default.join(toolPath, 'bin');
|
||||||
|
@ -72829,6 +72822,35 @@ class OfficialBuilds extends base_distribution_1.default {
|
||||||
core.addPath(toolPath);
|
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);
|
||||||
|
if (!evaluatedVersion) {
|
||||||
|
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);
|
||||||
|
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.');
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
evaluateVersions(versions) {
|
evaluateVersions(versions) {
|
||||||
let version = '';
|
let version = '';
|
||||||
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
|
if (this.isLatestSyntax(this.nodeInfo.versionSpec)) {
|
||||||
|
|
Loading…
Reference in a new issue