mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2025-05-19 12:54:45 +00:00
improve latest version syntax
This commit is contained in:
parent
3601f2a33e
commit
8c66f89aef
4 changed files with 11 additions and 17 deletions
|
@ -66,6 +66,11 @@ export async function getNode(
|
|||
}
|
||||
}
|
||||
|
||||
if (['current', 'latest', 'node'].includes(versionSpec)) {
|
||||
versionSpec = await queryDistForMatch(versionSpec, arch);
|
||||
core.info(`getting latest node version...`);
|
||||
}
|
||||
|
||||
// check cache
|
||||
let toolPath: string;
|
||||
toolPath = tc.find('node', versionSpec, osArch);
|
||||
|
@ -373,15 +378,6 @@ async function queryDistForMatch(
|
|||
let versions: string[] = [];
|
||||
let nodeVersions = await getVersionsFromDist();
|
||||
|
||||
if (
|
||||
versionSpec === 'current' ||
|
||||
versionSpec === 'latest' ||
|
||||
versionSpec === 'node'
|
||||
) {
|
||||
core.info(`getting latest node version...`);
|
||||
return nodeVersions[0].version;
|
||||
}
|
||||
|
||||
nodeVersions.forEach((nodeVersion: INodeVersion) => {
|
||||
// ensure this version supports your os and platform
|
||||
if (nodeVersion.files.indexOf(dataFileName) >= 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue