mirror of
https://github.com/actions/setup-node.git
synced 2025-11-07 04:56:55 +00:00
Compare commits
3 commits
34aba669ab
...
097b313821
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
097b313821 | ||
|
|
dda4788290 | ||
|
|
b8ecc20d6f |
2 changed files with 30 additions and 1 deletions
|
|
@ -125,7 +125,7 @@ steps:
|
|||
- run: npm test
|
||||
```
|
||||
|
||||
The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and don't rely on the system one.
|
||||
The `node-version` input is optional. If not supplied, the node version from PATH will be used. However, it is recommended to always specify Node.js version and not rely on the system one.
|
||||
|
||||
The action will first check the local cache for a semver match. If unable to find a specific version in the cache, the action will attempt to download a version of Node.js. It will pull LTS versions from [node-versions releases](https://github.com/actions/node-versions/releases) and on miss or failure will fall back to the previous behavior of downloading directly from [node dist](https://nodejs.org/dist/).
|
||||
|
||||
|
|
|
|||
|
|
@ -300,6 +300,35 @@ steps:
|
|||
- run: npm test
|
||||
```
|
||||
|
||||
**Restore-Only Cache**
|
||||
|
||||
```yaml
|
||||
## In some workflows, you may want to restore a cache without saving it. This can help reduce cache writes and storage usage in workflows that only need to read from cache
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
# Restore Node.js modules cache (restore-only)
|
||||
- name: Restore Node modules cache
|
||||
uses: actions/cache@v4
|
||||
id: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-node-
|
||||
# Setup Node.js
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: '24'
|
||||
# Install dependencies
|
||||
- run: npm install
|
||||
```
|
||||
|
||||
> For more details related to cache scenarios, please refer [Node – npm](https://github.com/actions/cache/blob/main/examples.md#node---npm).
|
||||
|
||||
## Multiple Operating Systems and Architectures
|
||||
|
||||
```yaml
|
||||
|
|
|
|||
Loading…
Reference in a new issue