mirror of
https://github.com/actions/setup-node.git
synced 2025-11-07 04:56:55 +00:00
Compare commits
3 commits
78786ddea5
...
9a45f4c370
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9a45f4c370 | ||
|
|
dda4788290 | ||
|
|
c1b361d808 |
3 changed files with 42 additions and 0 deletions
5
dist/setup/index.js
vendored
5
dist/setup/index.js
vendored
|
|
@ -99743,6 +99743,7 @@ const util_1 = __nccwpck_require__(54527);
|
||||||
const constants_1 = __nccwpck_require__(27242);
|
const constants_1 = __nccwpck_require__(27242);
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
var _a;
|
||||||
try {
|
try {
|
||||||
//
|
//
|
||||||
// Version is optional. If supplied, install / use from the tool cache
|
// Version is optional. If supplied, install / use from the tool cache
|
||||||
|
|
@ -99761,6 +99762,10 @@ function run() {
|
||||||
if (!arch) {
|
if (!arch) {
|
||||||
arch = os_1.default.arch();
|
arch = os_1.default.arch();
|
||||||
}
|
}
|
||||||
|
if ((_a = process.env.AGENT_TOOLSDIRECTORY) === null || _a === void 0 ? void 0 : _a.trim()) {
|
||||||
|
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
|
||||||
|
}
|
||||||
|
core.debug(`Node is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`);
|
||||||
if (version) {
|
if (version) {
|
||||||
const token = core.getInput('token');
|
const token = core.getInput('token');
|
||||||
const auth = !token ? undefined : `token ${token}`;
|
const auth = !token ? undefined : `token ${token}`;
|
||||||
|
|
|
||||||
|
|
@ -300,6 +300,35 @@ steps:
|
||||||
- run: npm test
|
- 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
|
## Multiple Operating Systems and Architectures
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,14 @@ export async function run() {
|
||||||
arch = os.arch();
|
arch = os.arch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||||
|
process.env['RUNNER_TOOL_CACHE'] = process.env['AGENT_TOOLSDIRECTORY'];
|
||||||
|
}
|
||||||
|
|
||||||
|
core.debug(
|
||||||
|
`Node is expected to be installed into ${process.env['RUNNER_TOOL_CACHE']}`
|
||||||
|
);
|
||||||
|
|
||||||
if (version) {
|
if (version) {
|
||||||
const token = core.getInput('token');
|
const token = core.getInput('token');
|
||||||
const auth = !token ? undefined : `token ${token}`;
|
const auth = !token ? undefined : `token ${token}`;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue