From 8438b85c7145b6ca21ab71e6cd83f6a9907784bc Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Mon, 30 May 2022 10:51:45 +0200 Subject: [PATCH] rebuild dist --- dist/setup/index.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 380702f8..fcafff7c 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -70619,6 +70619,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) { return __awaiter(this, void 0, void 0, function* () { // Store manifest data to avoid multiple calls let manifest; + let nodeVersions; let osPlat = os.platform(); let osArch = translateArchToDistUrl(arch); if (isLtsAlias(versionSpec)) { @@ -70627,6 +70628,11 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) { manifest = yield getManifest(auth); versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, manifest); } + if (isLatestSyntax(versionSpec)) { + nodeVersions = yield getVersionsFromDist(); + versionSpec = yield queryDistForMatch(versionSpec, arch, nodeVersions); + core.info(`getting latest node version...`); + } if (checkLatest) { core.info('Attempt to resolve the latest version from manifest...'); const resolvedVersion = yield resolveVersionFromManifest(versionSpec, stable, auth, osArch, manifest); @@ -70678,7 +70684,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) { // Download from nodejs.org // if (!downloadPath) { - info = yield getInfoFromDist(versionSpec, arch); + info = yield getInfoFromDist(versionSpec, arch, nodeVersions); if (!info) { throw new Error(`Unable to find Node version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`); } @@ -70778,12 +70784,11 @@ function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchTo return info; }); } -function getInfoFromDist(versionSpec, arch = os.arch()) { +function getInfoFromDist(versionSpec, arch = os.arch(), nodeVersions) { return __awaiter(this, void 0, void 0, function* () { let osPlat = os.platform(); let osArch = translateArchToDistUrl(arch); - let version; - version = yield queryDistForMatch(versionSpec, arch); + let version = yield queryDistForMatch(versionSpec, arch, nodeVersions); if (!version) { return null; } @@ -70842,7 +70847,7 @@ function evaluateVersions(versions, versionSpec) { } return version; } -function queryDistForMatch(versionSpec, arch = os.arch()) { +function queryDistForMatch(versionSpec, arch = os.arch(), nodeVersions) { return __awaiter(this, void 0, void 0, function* () { let osPlat = os.platform(); let osArch = translateArchToDistUrl(arch); @@ -70861,8 +70866,15 @@ function queryDistForMatch(versionSpec, arch = os.arch()) { default: throw new Error(`Unexpected OS '${osPlat}'`); } + if (!nodeVersions) { + core.debug('No dist manifest cached'); + nodeVersions = yield getVersionsFromDist(); + } let versions = []; - let nodeVersions = yield getVersionsFromDist(); + if (isLatestSyntax(versionSpec)) { + core.info(`getting latest node version...`); + return nodeVersions[0].version; + } nodeVersions.forEach((nodeVersion) => { // ensure this version supports your os and platform if (nodeVersion.files.indexOf(dataFileName) >= 0) { @@ -70958,6 +70970,9 @@ function parseNodeVersionFile(contents) { return nodeVersion; } exports.parseNodeVersionFile = parseNodeVersionFile; +function isLatestSyntax(versionSpec) { + return ['current', 'latest', 'node'].includes(versionSpec); +} /***/ }),