1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-node synced 2025-06-18 17:40:26 +02:00

Adding Node.js version file support (#338)

This commit is contained in:
Hargun Kaur 2021-11-29 14:48:31 +05:30 committed by GitHub
parent 360ab8b75b
commit d08cf22211
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 221 additions and 23 deletions

View file

@ -371,7 +371,7 @@ async function queryDistForMatch(
}
let versions: string[] = [];
let nodeVersions = await module.exports.getVersionsFromDist();
let nodeVersions = await getVersionsFromDist();
nodeVersions.forEach((nodeVersion: INodeVersion) => {
// ensure this version supports your os and platform
@ -464,3 +464,12 @@ function translateArchToDistUrl(arch: string): string {
return arch;
}
}
export function parseNodeVersionFile(contents: string): string {
let nodeVersion = contents.trim();
if (/^v\d/.test(nodeVersion)) {
nodeVersion = nodeVersion.substring(1);
}
return nodeVersion;
}