diff --git a/dist/setup/index.js b/dist/setup/index.js index 6ee7f6f9..a0f91fef 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -73239,7 +73239,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) { // Try download from internal distribution (popular versions only) // try { - info = yield getInfoFromManifest(versionSpec, stable, auth, osArch, manifest); + info = yield getInfoFromManifest(versionSpec, !isNightly, auth, osArch, manifest); if (info) { core.info(`Acquiring ${info.resolvedVersion} - ${info.arch} from ${info.downloadUrl}`); downloadPath = yield tc.downloadTool(info.downloadUrl, undefined, auth); @@ -73416,7 +73416,7 @@ function evaluateVersions(versions, versionSpec) { core.debug(`evaluating ${versions.length} versions`); core.debug(`version 1 is ${versions[0]}`); core.debug(`version spec is ${versionSpec}`); - versions = versions.map(item => item.replace('-nightly', '+nightly.')).sort((a, b) => { + versions = versions.sort((a, b) => { if (semver.gt(a, b)) { return 1; } @@ -73424,7 +73424,7 @@ function evaluateVersions(versions, versionSpec) { }); for (let i = versions.length - 1; i >= 0; i--) { const potential = versions[i]; - const satisfied = semver.satisfies(potential, versionSpec.replace('-', '+')); + const satisfied = semver.satisfies(potential.replace('-nightly', '+nightly.'), versionSpec.replace('-nightly', '+nightly.')); if (satisfied) { version = potential; break; diff --git a/src/installer.ts b/src/installer.ts index 375b1894..595ea65f 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -99,7 +99,7 @@ export async function getNode( try { info = await getInfoFromManifest( versionSpec, - stable, + !isNightly, auth, osArch, manifest @@ -353,7 +353,7 @@ function evaluateVersions(versions: string[], versionSpec: string): string { core.debug(`evaluating ${versions.length} versions`); core.debug(`version 1 is ${versions[0]}`); core.debug(`version spec is ${versionSpec}`); - versions = versions.map(item => item.replace('-nightly', '+nightly.')).sort((a, b) => { + versions = versions.sort((a, b) => { if (semver.gt(a, b)) { return 1; } @@ -361,7 +361,10 @@ function evaluateVersions(versions: string[], versionSpec: string): string { }); for (let i = versions.length - 1; i >= 0; i--) { const potential: string = versions[i]; - const satisfied: boolean = semver.satisfies(potential, versionSpec.replace('-', '+')); + const satisfied: boolean = semver.satisfies( + potential.replace('-nightly', '+nightly.'), + versionSpec.replace('-nightly', '+nightly.') + ); if (satisfied) { version = potential; break; @@ -436,7 +439,9 @@ async function queryDistForMatch( return version; } -export async function getVersionsFromDist(versionSpec: string): Promise { +export async function getVersionsFromDist( + versionSpec: string +): Promise { const initialUrl = getNodejsDistUrl(versionSpec); const dataUrl = `${initialUrl}/index.json`; let httpClient = new hc.HttpClient('setup-node', [], {