mirror of
https://codeberg.org/actions/setup-node.git
synced 2023-07-31 13:16:24 +00:00
Rename
This commit is contained in:
parent
36d2ce149e
commit
c62861c1e7
14
dist/index.js
vendored
14
dist/index.js
vendored
|
@ -13107,7 +13107,7 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let osPlat = os.platform();
|
let osPlat = os.platform();
|
||||||
let osArch = translateArchToDistUrl(arch);
|
let osArch = translateArchToDistUrl(arch);
|
||||||
if (isLtsVersion(versionSpec)) {
|
if (isLtsAlias(versionSpec)) {
|
||||||
core.info('LTS version is provided. For LTS versions `check-latest` will be automatically set to true');
|
core.info('LTS version is provided. For LTS versions `check-latest` will be automatically set to true');
|
||||||
checkLatest = true;
|
checkLatest = true;
|
||||||
}
|
}
|
||||||
|
@ -13220,10 +13220,10 @@ function getNode(versionSpec, stable, checkLatest, auth, arch = os.arch()) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.getNode = getNode;
|
exports.getNode = getNode;
|
||||||
function isLtsVersion(versionSpec) {
|
function isLtsAlias(versionSpec) {
|
||||||
return versionSpec.startsWith('lts');
|
return versionSpec.startsWith('lts');
|
||||||
}
|
}
|
||||||
function findLtsVersionFromManifest(versionSpec, stable, candidates) {
|
function resolveLtsAliasFromManifest(versionSpec, stable, manifest) {
|
||||||
var _a;
|
var _a;
|
||||||
const alias = (_a = versionSpec.split('lts/')[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
const alias = (_a = versionSpec.split('lts/')[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
||||||
if (!alias) {
|
if (!alias) {
|
||||||
|
@ -13232,8 +13232,8 @@ function findLtsVersionFromManifest(versionSpec, stable, candidates) {
|
||||||
core.debug(`LTS alias '${alias}' for Node version '${versionSpec}'`);
|
core.debug(`LTS alias '${alias}' for Node version '${versionSpec}'`);
|
||||||
// Supported formats are `lts/<alias>` and `lts/*`. Where asterisk means highest possible LTS.
|
// Supported formats are `lts/<alias>` and `lts/*`. Where asterisk means highest possible LTS.
|
||||||
const release = alias === '*'
|
const release = alias === '*'
|
||||||
? candidates.find(x => !!x.lts && x.stable === stable)
|
? manifest.find(x => !!x.lts && x.stable === stable)
|
||||||
: candidates.find(x => { var _a; return ((_a = x.lts) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === alias && x.stable === stable; });
|
: manifest.find(x => { var _a; return ((_a = x.lts) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === alias && x.stable === stable; });
|
||||||
if (!release) {
|
if (!release) {
|
||||||
throw new Error(`Unable to find LTS release '${alias}' for Node version '${versionSpec}'.`);
|
throw new Error(`Unable to find LTS release '${alias}' for Node version '${versionSpec}'.`);
|
||||||
}
|
}
|
||||||
|
@ -13244,8 +13244,8 @@ function getInfoFromManifest(versionSpec, stable, auth, osArch = translateArchTo
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let info = null;
|
let info = null;
|
||||||
const releases = yield tc.getManifestFromRepo('actions', 'node-versions', auth, 'main');
|
const releases = yield tc.getManifestFromRepo('actions', 'node-versions', auth, 'main');
|
||||||
if (isLtsVersion(versionSpec)) {
|
if (isLtsAlias(versionSpec)) {
|
||||||
versionSpec = findLtsVersionFromManifest(versionSpec, stable, releases);
|
versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, releases);
|
||||||
}
|
}
|
||||||
const rel = yield tc.findFromManifest(versionSpec, stable, releases, osArch);
|
const rel = yield tc.findFromManifest(versionSpec, stable, releases, osArch);
|
||||||
if (rel && rel.files.length > 0) {
|
if (rel && rel.files.length > 0) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ export async function getNode(
|
||||||
let osPlat: string = os.platform();
|
let osPlat: string = os.platform();
|
||||||
let osArch: string = translateArchToDistUrl(arch);
|
let osArch: string = translateArchToDistUrl(arch);
|
||||||
|
|
||||||
if (isLtsVersion(versionSpec)) {
|
if (isLtsAlias(versionSpec)) {
|
||||||
core.info('LTS version is provided. For LTS versions `check-latest` will be automatically set to true');
|
core.info('LTS version is provided. For LTS versions `check-latest` will be automatically set to true');
|
||||||
checkLatest = true;
|
checkLatest = true;
|
||||||
}
|
}
|
||||||
|
@ -179,14 +179,14 @@ export async function getNode(
|
||||||
core.addPath(toolPath);
|
core.addPath(toolPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isLtsVersion(versionSpec: string): boolean {
|
function isLtsAlias(versionSpec: string): boolean {
|
||||||
return versionSpec.startsWith('lts')
|
return versionSpec.startsWith('lts')
|
||||||
}
|
}
|
||||||
|
|
||||||
function findLtsVersionFromManifest(
|
function resolveLtsAliasFromManifest(
|
||||||
versionSpec: string,
|
versionSpec: string,
|
||||||
stable: boolean,
|
stable: boolean,
|
||||||
candidates: INodeRelease[]
|
manifest: INodeRelease[]
|
||||||
): string {
|
): string {
|
||||||
const alias = versionSpec.split('lts/')[1]?.toLowerCase();
|
const alias = versionSpec.split('lts/')[1]?.toLowerCase();
|
||||||
|
|
||||||
|
@ -198,8 +198,8 @@ function findLtsVersionFromManifest(
|
||||||
|
|
||||||
// Supported formats are `lts/<alias>` and `lts/*`. Where asterisk means highest possible LTS.
|
// Supported formats are `lts/<alias>` and `lts/*`. Where asterisk means highest possible LTS.
|
||||||
const release = alias === '*'
|
const release = alias === '*'
|
||||||
? candidates.find(x => !!x.lts && x.stable === stable)
|
? manifest.find(x => !!x.lts && x.stable === stable)
|
||||||
: candidates.find(x => x.lts?.toLowerCase() === alias && x.stable === stable);
|
: manifest.find(x => x.lts?.toLowerCase() === alias && x.stable === stable);
|
||||||
|
|
||||||
if (!release) {
|
if (!release) {
|
||||||
throw new Error(`Unable to find LTS release '${alias}' for Node version '${versionSpec}'.`);
|
throw new Error(`Unable to find LTS release '${alias}' for Node version '${versionSpec}'.`);
|
||||||
|
@ -224,8 +224,8 @@ async function getInfoFromManifest(
|
||||||
'main'
|
'main'
|
||||||
);
|
);
|
||||||
|
|
||||||
if (isLtsVersion(versionSpec)) {
|
if (isLtsAlias(versionSpec)) {
|
||||||
versionSpec = findLtsVersionFromManifest(versionSpec, stable, releases);
|
versionSpec = resolveLtsAliasFromManifest(versionSpec, stable, releases);
|
||||||
}
|
}
|
||||||
|
|
||||||
const rel = await tc.findFromManifest(versionSpec, stable, releases, osArch);
|
const rel = await tc.findFromManifest(versionSpec, stable, releases, osArch);
|
||||||
|
|
Loading…
Reference in a new issue