mirror of
https://github.com/actions/setup-node
synced 2025-04-21 15:52:09 +00:00
add corepack option
This commit is contained in:
parent
c81d8ad96d
commit
394059ca5f
@ -13,7 +13,10 @@ inputs:
|
|||||||
description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.'
|
description: 'Target architecture for Node to use. Examples: x86, x64. Will use system architecture by default.'
|
||||||
check-latest:
|
check-latest:
|
||||||
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec.'
|
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec.'
|
||||||
default: false
|
default: 'false'
|
||||||
|
corepack:
|
||||||
|
description: 'Set this option if you want to install the core-pack.'
|
||||||
|
default: 'false'
|
||||||
registry-url:
|
registry-url:
|
||||||
description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.'
|
description: 'Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file, and set up auth to read in from env.NODE_AUTH_TOKEN.'
|
||||||
scope:
|
scope:
|
||||||
|
11
src/main.ts
11
src/main.ts
@ -1,12 +1,12 @@
|
|||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import * as installer from './installer';
|
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import * as auth from './authutil';
|
import os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as auth from './authutil';
|
||||||
import {restoreCache} from './cache-restore';
|
import {restoreCache} from './cache-restore';
|
||||||
import {isGhes, isCacheFeatureAvailable} from './cache-utils';
|
import {isGhes, isCacheFeatureAvailable} from './cache-utils';
|
||||||
import os = require('os');
|
import * as installer from './installer';
|
||||||
|
|
||||||
export async function run() {
|
export async function run() {
|
||||||
try {
|
try {
|
||||||
@ -48,6 +48,11 @@ export async function run() {
|
|||||||
auth.configAuthentication(registryUrl, alwaysAuth);
|
auth.configAuthentication(registryUrl, alwaysAuth);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const enableCorepack = core.getInput('corepack');
|
||||||
|
if (enableCorepack === 'true') {
|
||||||
|
await exec.exec('corepack', ['enable']);
|
||||||
|
}
|
||||||
|
|
||||||
if (cache && isCacheFeatureAvailable()) {
|
if (cache && isCacheFeatureAvailable()) {
|
||||||
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
||||||
await restoreCache(cache, cacheDependencyPath);
|
await restoreCache(cache, cacheDependencyPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user