Support lts/* alias

This commit is contained in:
Gordey Doronin 2021-06-17 18:34:09 +02:00
parent 88d5bfde31
commit c8889b24a3
2 changed files with 61 additions and 4 deletions

View file

@ -192,13 +192,15 @@ function findLtsVersionFromManifest(
core.debug(`LTS alias '${alias}' for Node version '${versionSpec}'`);
const release = candidates.find(x => x.lts?.toLowerCase() === alias && x.stable === stable);
const release = alias === '*'
? candidates.find(x => !!x.lts && x.stable === stable)
: candidates.find(x => x.lts?.toLowerCase() === alias && x.stable === stable);
if (!release) {
throw new Error(`Unable to find LTS release '${alias}' for Node version '${versionSpec}'.`);
}
core.debug(`Found LTS release '${alias}' for Node version '${versionSpec}'`);
core.debug(`Found LTS release '${release.version}' for Node version '${versionSpec}'`);
return release.version.split('.')[0];
}