From f454ce2807f7155c17c73d4e28375dc90d80eead Mon Sep 17 00:00:00 2001 From: Karl Horky <karl.horky@gmail.com> Date: Sat, 27 Jul 2024 13:49:33 +0200 Subject: [PATCH 1/2] Add warning and caveat for NVM syntax --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6b14f9259..92df7d7f2 100644 --- a/README.md +++ b/README.md @@ -105,9 +105,11 @@ Examples: - Major versions: `18`, `20` - More specific versions: `10.15`, `16.15.1` , `18.4.0` - - NVM LTS syntax: `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n` + - NVM LTS syntax (beware of caveat below): `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n` - Latest release: `*` or `latest`/`current`/`node` +**Caveat for NVM syntax:** There is currently no way to ensure that NVM version syntax like `lts/*` will receive the latest LTS release immediately - it can take days to update to the latest LTS because of cache implementation details (see [this issue]([https://github.com/actions/setup-node](https://github.com/actions/setup-node/issues/940#issuecomment-2029638604))). If you need the latest LTS versions in a timely manner, it is recommended to use a different action than `actions/setup-node`. + **Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input. `current`/`latest`/`node` always resolve to the latest [dist version](https://nodejs.org/dist/index.json). From 6f485d0d117c04128b83669256a24144b3bcaeca Mon Sep 17 00:00:00 2001 From: Karl Horky <karl.horky@gmail.com> Date: Thu, 6 Mar 2025 17:00:28 +0100 Subject: [PATCH 2/2] Add Caching Caveat note, add `check-latest: true` to examples --- README.md | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 92df7d7f2..0885a04df 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,7 @@ steps: - uses: actions/setup-node@v4 with: node-version: 18 + check-latest: true - run: npm ci - run: npm test ``` @@ -103,14 +104,13 @@ The `node-version` input supports the Semantic Versioning Specification, for mor Examples: - - Major versions: `18`, `20` - - More specific versions: `10.15`, `16.15.1` , `18.4.0` - - NVM LTS syntax (beware of caveat below): `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n` - - Latest release: `*` or `latest`/`current`/`node` +- Specific versions: `10.15`, `16.15.1` , `18.4.0` +- Version ranges (see **Caching Caveat** below) + - Major versions: `18`, `20` + - NVM LTS syntax: `lts/erbium`, `lts/fermium`, `lts/*`, `lts/-n` + - Latest release: `*` or `latest`/`current`/`node` -**Caveat for NVM syntax:** There is currently no way to ensure that NVM version syntax like `lts/*` will receive the latest LTS release immediately - it can take days to update to the latest LTS because of cache implementation details (see [this issue]([https://github.com/actions/setup-node](https://github.com/actions/setup-node/issues/940#issuecomment-2029638604))). If you need the latest LTS versions in a timely manner, it is recommended to use a different action than `actions/setup-node`. - -**Note:** Like the other values, `*` will get the latest [locally-cached Node.js version](https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md#nodejs), or the latest version from [actions/node-versions](https://github.com/actions/node-versions/blob/main/versions-manifest.json), depending on the [`check-latest`](docs/advanced-usage.md#check-latest-version) input. +**Caching Caveat:** Version ranges may be cached for an indefinite time without the `check-latest: true` option - they may be stale for [durations up to 1 month](https://github.com/actions/setup-node/issues/1236#issuecomment-2704188519) `current`/`latest`/`node` always resolve to the latest [dist version](https://nodejs.org/dist/index.json). That version is then downloaded from actions/node-versions if possible, or directly from Node.js if not. @@ -138,6 +138,7 @@ steps: - uses: actions/setup-node@v4 with: node-version: 20 + check-latest: true cache: 'npm' - run: npm ci - run: npm test @@ -151,6 +152,7 @@ steps: - uses: actions/setup-node@v4 with: node-version: 20 + check-latest: true cache: 'npm' cache-dependency-path: subdir/package-lock.json - run: npm ci @@ -173,6 +175,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: ${{ matrix.node }} + check-latest: true - run: npm ci - run: npm test ```