mirror of
https://gitea.com/actions/setup-node.git
synced 2025-07-22 11:28:06 +08:00
Adding Node.js version file support (#338)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user