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:
parent
360ab8b75b
commit
d08cf22211
9 changed files with 221 additions and 23 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue