Try changes again

This commit is contained in:
Danny McCormick 2019-08-06 14:46:42 -04:00
parent 869ebd91d5
commit f1da8b89e2
2 changed files with 9 additions and 14 deletions

View File

@ -13,14 +13,10 @@ const path = __importStar(require("path"));
const core = __importStar(require("@actions/core"));
const github = __importStar(require("@actions/github"));
function configAuthentication(registryUrl) {
// const npmrc: string = path.resolve(
// process.env['RUNNER_TEMP'] || process.cwd(),
// '.npmrc'
// );
const npmrc = path.resolve(process.env['RUNNER_TEMP'] || process.cwd(), '.npmrc');
if (!registryUrl.endsWith('/')) {
registryUrl += '/';
}
const npmrc = path.resolve(process.cwd(), '.npmrc');
writeRegistryToFile(registryUrl, npmrc);
}
exports.configAuthentication = configAuthentication;
@ -50,7 +46,7 @@ function writeRegistryToFile(registryUrl, fileLocation) {
: `registry=${registryUrl}`;
newContents += `${authString}${os.EOL}${registryString}`;
fs.writeFileSync(fileLocation, newContents);
// core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
// Export empty node_auth_token so npm doesn't complain about not being able to find it
// core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
}

View File

@ -5,14 +5,13 @@ import * as core from '@actions/core';
import * as github from '@actions/github';
export function configAuthentication(registryUrl: string) {
// const npmrc: string = path.resolve(
// process.env['RUNNER_TEMP'] || process.cwd(),
// '.npmrc'
// );
const npmrc: string = path.resolve(
process.env['RUNNER_TEMP'] || process.cwd(),
'.npmrc'
);
if (!registryUrl.endsWith('/')) {
registryUrl += '/';
}
const npmrc: string = path.resolve(process.cwd(), '.npmrc');
writeRegistryToFile(registryUrl, npmrc);
}
@ -45,7 +44,7 @@ function writeRegistryToFile(registryUrl: string, fileLocation: string) {
: `registry=${registryUrl}`;
newContents += `${authString}${os.EOL}${registryString}`;
fs.writeFileSync(fileLocation, newContents);
// core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
core.exportVariable('NPM_CONFIG_USERCONFIG', fileLocation);
// Export empty node_auth_token so npm doesn't complain about not being able to find it
// core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
core.exportVariable('NODE_AUTH_TOKEN', 'XXXXX-XXXXX-XXXXX-XXXXX');
}