mirror of
https://github.com/actions/setup-node.git
synced 2024-12-23 17:36:32 +08:00
Update
This commit is contained in:
parent
409b7dfb5b
commit
0930c1111e
|
@ -15,19 +15,21 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const core = __importStar(require("@actions/core"));
|
||||||
const path = __importStar(require("path"));
|
const path = __importStar(require("path"));
|
||||||
const exec = __importStar(require("@actions/exec"));
|
const exec = __importStar(require("@actions/exec"));
|
||||||
function configAuth(registryUrl) {
|
function configAuth(registryUrl) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let npmrc = path.resolve(process.cwd(), '.npmrc');
|
let npmrc = path.resolve(process.cwd(), '.npmrc');
|
||||||
let yarnrc = path.resolve(process.cwd(), '.yarnrc');
|
let yarnrc = path.resolve(process.cwd(), '.yarnrc');
|
||||||
writeRegistryToFile(registryUrl, 'npm', 'NPM_TOKEN');
|
yield writeRegistryToFile(registryUrl, 'npm', 'NPM_TOKEN');
|
||||||
writeRegistryToFile(registryUrl, 'yarn', 'YARN_TOKEN');
|
// writeRegistryToFile(registryUrl, 'yarn', 'YARN_TOKEN');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.configAuth = configAuth;
|
exports.configAuth = configAuth;
|
||||||
function writeRegistryToFile(registryUrl, packageManager, authTokenName) {
|
function writeRegistryToFile(registryUrl, packageManager, authTokenName) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
core.debug(`Setting up ${packageManager} auth`);
|
||||||
yield exec.exec(`${packageManager} config set registry=${registryUrl}`);
|
yield exec.exec(`${packageManager} config set registry=${registryUrl}`);
|
||||||
yield exec.exec(`${packageManager} config set always-auth=true`);
|
yield exec.exec(`${packageManager} config set always-auth=true`);
|
||||||
yield exec.exec(packageManager +
|
yield exec.exec(packageManager +
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import * as fs from 'fs';
|
import * as core from '@actions/core';
|
||||||
import * as os from 'os';
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
|
|
||||||
|
@ -7,8 +6,8 @@ export async function configAuth(registryUrl: string) {
|
||||||
let npmrc: string = path.resolve(process.cwd(), '.npmrc');
|
let npmrc: string = path.resolve(process.cwd(), '.npmrc');
|
||||||
let yarnrc: string = path.resolve(process.cwd(), '.yarnrc');
|
let yarnrc: string = path.resolve(process.cwd(), '.yarnrc');
|
||||||
|
|
||||||
writeRegistryToFile(registryUrl, 'npm', 'NPM_TOKEN');
|
await writeRegistryToFile(registryUrl, 'npm', 'NPM_TOKEN');
|
||||||
writeRegistryToFile(registryUrl, 'yarn', 'YARN_TOKEN');
|
// writeRegistryToFile(registryUrl, 'yarn', 'YARN_TOKEN');
|
||||||
}
|
}
|
||||||
|
|
||||||
async function writeRegistryToFile(
|
async function writeRegistryToFile(
|
||||||
|
@ -16,6 +15,7 @@ async function writeRegistryToFile(
|
||||||
packageManager: string,
|
packageManager: string,
|
||||||
authTokenName: string
|
authTokenName: string
|
||||||
) {
|
) {
|
||||||
|
core.debug(`Setting up ${packageManager} auth`);
|
||||||
await exec.exec(`${packageManager} config set registry=${registryUrl}`);
|
await exec.exec(`${packageManager} config set registry=${registryUrl}`);
|
||||||
await exec.exec(`${packageManager} config set always-auth=true`);
|
await exec.exec(`${packageManager} config set always-auth=true`);
|
||||||
await exec.exec(
|
await exec.exec(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user