Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add caveat for version ranges #1114

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ steps:
- uses: actions/setup-node@v4
with:
node-version: 18
check-latest: true
- run: npm ci
- run: npm test
```
Expand All @@ -103,12 +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: `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`

**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.
Expand Down Expand Up @@ -136,6 +138,7 @@ steps:
- uses: actions/setup-node@v4
with:
node-version: 20
check-latest: true
cache: 'npm'
- run: npm ci
- run: npm test
Expand All @@ -149,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
Expand All @@ -171,6 +175,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
check-latest: true
- run: npm ci
- run: npm test
```
Expand Down