mirror of
https://github.com/actions/setup-node.git
synced 2026-06-14 14:13:52 +08:00
Compare commits
3 Commits
v6.0.0
...
75340fa5cc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75340fa5cc | ||
|
|
fc2e41dd00 | ||
|
|
dda4788290 |
@@ -133,10 +133,11 @@ describe('main tests', () => {
|
|||||||
|
|
||||||
describe('printEnvDetailsAndSetOutput', () => {
|
describe('printEnvDetailsAndSetOutput', () => {
|
||||||
it.each([
|
it.each([
|
||||||
[{node: '12.0.2', npm: '6.3.3', yarn: '1.22.11'}],
|
[{node: '12.0.2', npm: '6.3.3', yarn: '1.22.11', pnpm: ''}],
|
||||||
[{node: '16.0.2', npm: '7.3.3', yarn: '2.22.11'}],
|
[{node: '16.0.2', npm: '7.3.3', yarn: '2.22.11', pnpm: ''}],
|
||||||
[{node: '14.0.1', npm: '8.1.0', yarn: '3.2.1'}],
|
[{node: '14.0.1', npm: '8.1.0', yarn: '3.2.1', pnpm: ''}],
|
||||||
[{node: '17.0.2', npm: '6.3.3', yarn: ''}]
|
[{node: '17.0.2', npm: '6.3.3', yarn: '', pnpm: ''}],
|
||||||
|
[{node: '24.10.0', npm: '11.6.1', yarn: '', pnpm: '10.18.3'}]
|
||||||
])('Tools versions %p', async obj => {
|
])('Tools versions %p', async obj => {
|
||||||
getExecOutputSpy.mockImplementation(async command => {
|
getExecOutputSpy.mockImplementation(async command => {
|
||||||
if (Reflect.has(obj, command) && !obj[command]) {
|
if (Reflect.has(obj, command) && !obj[command]) {
|
||||||
|
|||||||
2
dist/cache-save/index.js
vendored
2
dist/cache-save/index.js
vendored
@@ -89446,7 +89446,7 @@ exports.getNodeVersionFromFile = getNodeVersionFromFile;
|
|||||||
function printEnvDetailsAndSetOutput() {
|
function printEnvDetailsAndSetOutput() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.startGroup('Environment details');
|
core.startGroup('Environment details');
|
||||||
const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
|
const promises = ['node', 'npm', 'yarn', 'pnpm'].map((tool) => __awaiter(this, void 0, void 0, function* () {
|
||||||
const pathTool = yield io.which(tool, false);
|
const pathTool = yield io.which(tool, false);
|
||||||
const output = pathTool ? yield getToolVersion(tool, ['--version']) : '';
|
const output = pathTool ? yield getToolVersion(tool, ['--version']) : '';
|
||||||
return { tool, output };
|
return { tool, output };
|
||||||
|
|||||||
2
dist/setup/index.js
vendored
2
dist/setup/index.js
vendored
@@ -99961,7 +99961,7 @@ exports.getNodeVersionFromFile = getNodeVersionFromFile;
|
|||||||
function printEnvDetailsAndSetOutput() {
|
function printEnvDetailsAndSetOutput() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
core.startGroup('Environment details');
|
core.startGroup('Environment details');
|
||||||
const promises = ['node', 'npm', 'yarn'].map((tool) => __awaiter(this, void 0, void 0, function* () {
|
const promises = ['node', 'npm', 'yarn', 'pnpm'].map((tool) => __awaiter(this, void 0, void 0, function* () {
|
||||||
const pathTool = yield io.which(tool, false);
|
const pathTool = yield io.which(tool, false);
|
||||||
const output = pathTool ? yield getToolVersion(tool, ['--version']) : '';
|
const output = pathTool ? yield getToolVersion(tool, ['--version']) : '';
|
||||||
return { tool, output };
|
return { tool, output };
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ export function getNodeVersionFromFile(versionFilePath: string): string | null {
|
|||||||
|
|
||||||
export async function printEnvDetailsAndSetOutput() {
|
export async function printEnvDetailsAndSetOutput() {
|
||||||
core.startGroup('Environment details');
|
core.startGroup('Environment details');
|
||||||
const promises = ['node', 'npm', 'yarn'].map(async tool => {
|
const promises = ['node', 'npm', 'yarn', 'pnpm'].map(async tool => {
|
||||||
const pathTool = await io.which(tool, false);
|
const pathTool = await io.which(tool, false);
|
||||||
const output = pathTool ? await getToolVersion(tool, ['--version']) : '';
|
const output = pathTool ? await getToolVersion(tool, ['--version']) : '';
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user