From 0093214f7abdad5a0550f0824d2c20067d042d2d Mon Sep 17 00:00:00 2001 From: bluelovers Date: Thu, 17 Feb 2022 00:42:14 +0800 Subject: [PATCH 1/2] feat: add support `node` is an alias for the latest version https://github.com/nvm-sh/nvm#usage --- .github/workflows/versions.yml | 14 ++++++++++++++ src/installer.ts | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/.github/workflows/versions.yml b/.github/workflows/versions.yml index d13fe4024..6b299c1f3 100644 --- a/.github/workflows/versions.yml +++ b/.github/workflows/versions.yml @@ -43,6 +43,20 @@ jobs: with: 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: runs-on: ${{ matrix.os }} strategy: diff --git a/src/installer.ts b/src/installer.ts index a9baae0a1..3d713ae30 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -373,6 +373,10 @@ async function queryDistForMatch( let versions: string[] = []; let nodeVersions = await getVersionsFromDist(); + if (versionSpec === 'node') { + return nodeVersions[0].version; + } + nodeVersions.forEach((nodeVersion: INodeVersion) => { // ensure this version supports your os and platform if (nodeVersion.files.indexOf(dataFileName) >= 0) { From 91bdfe313e97ccbc806190840715791590f5989f Mon Sep 17 00:00:00 2001 From: bluelovers Date: Thu, 21 Apr 2022 03:25:45 +0800 Subject: [PATCH 2/2] Update README.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Alexander Böhm <3983539+mheob@users.noreply.github.com> --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e997b92e5..65acf7ac8 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ The `node-version` input supports the following syntax: major versions: `12`, `14`, `16` more specific versions: `10.15`, `14.2.0`, `16.3.0` nvm lts syntax: `lts/erbium`, `lts/fermium`, `lts/*` +nvm latest version syntax: `node` ## Caching global packages data