feat: add support node is an alias for the latest version

https://github.com/nvm-sh/nvm#usage
This commit is contained in:
bluelovers 2022-02-17 00:42:14 +08:00
parent 86bf502a33
commit 0093214f7a
2 changed files with 18 additions and 0 deletions

View file

@ -43,6 +43,20 @@ jobs:
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
latest-syntax:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: [node]
steps:
- uses: actions/checkout@v2
- name: Setup Node
uses: ./
with:
node-version: ${{ matrix.node-version }}
manifest: manifest:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
strategy: strategy:

View file

@ -373,6 +373,10 @@ async function queryDistForMatch(
let versions: string[] = []; let versions: string[] = [];
let nodeVersions = await getVersionsFromDist(); let nodeVersions = await getVersionsFromDist();
if (versionSpec === 'node') {
return nodeVersions[0].version;
}
nodeVersions.forEach((nodeVersion: INodeVersion) => { nodeVersions.forEach((nodeVersion: INodeVersion) => {
// ensure this version supports your os and platform // ensure this version supports your os and platform
if (nodeVersion.files.indexOf(dataFileName) >= 0) { if (nodeVersion.files.indexOf(dataFileName) >= 0) {