mirror of
https://code.forgejo.org/actions/setup-node.git
synced 2024-11-24 08:51:01 -05:00
Keep in root of repo
This commit is contained in:
parent
4d381b188a
commit
0dfe4cf4d4
2 changed files with 14 additions and 9 deletions
|
@ -13,10 +13,14 @@ const path = __importStar(require("path"));
|
||||||
const core = __importStar(require("@actions/core"));
|
const core = __importStar(require("@actions/core"));
|
||||||
const github = __importStar(require("@actions/github"));
|
const github = __importStar(require("@actions/github"));
|
||||||
function configAuthentication(registryUrl) {
|
function configAuthentication(registryUrl) {
|
||||||
const npmrc = path.resolve(process.env['RUNNER_TEMP'] || process.cwd(), '.npmrc');
|
// const npmrc: string = path.resolve(
|
||||||
|
// process.env['RUNNER_TEMP'] || process.cwd(),
|
||||||
|
// '.npmrc'
|
||||||
|
// );
|
||||||
if (!registryUrl.endsWith('/')) {
|
if (!registryUrl.endsWith('/')) {
|
||||||
registryUrl += '/';
|
registryUrl += '/';
|
||||||
}
|
}
|
||||||
|
const npmrc = path.resolve(process.cwd(), '.npmrc');
|
||||||
writeRegistryToFile(registryUrl, npmrc);
|
writeRegistryToFile(registryUrl, npmrc);
|
||||||
}
|
}
|
||||||
exports.configAuthentication = configAuthentication;
|
exports.configAuthentication = configAuthentication;
|
||||||
|
@ -46,7 +50,7 @@ function writeRegistryToFile(registryUrl, fileLocation) {
|
||||||
: `registry=${registryUrl}`;
|
: `registry=${registryUrl}`;
|
||||||
newContents += `${authString}${os.EOL}${registryString}`;
|
newContents += `${authString}${os.EOL}${registryString}`;
|
||||||
fs.writeFileSync(fileLocation, newContents);
|
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
|
// 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');
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,13 +5,14 @@ import * as core from '@actions/core';
|
||||||
import * as github from '@actions/github';
|
import * as github from '@actions/github';
|
||||||
|
|
||||||
export function configAuthentication(registryUrl: string) {
|
export function configAuthentication(registryUrl: string) {
|
||||||
const npmrc: string = path.resolve(
|
// const npmrc: string = path.resolve(
|
||||||
process.env['RUNNER_TEMP'] || process.cwd(),
|
// process.env['RUNNER_TEMP'] || process.cwd(),
|
||||||
'.npmrc'
|
// '.npmrc'
|
||||||
);
|
// );
|
||||||
if (!registryUrl.endsWith('/')) {
|
if (!registryUrl.endsWith('/')) {
|
||||||
registryUrl += '/';
|
registryUrl += '/';
|
||||||
}
|
}
|
||||||
|
const npmrc: string = path.resolve(process.cwd(), '.npmrc');
|
||||||
|
|
||||||
writeRegistryToFile(registryUrl, npmrc);
|
writeRegistryToFile(registryUrl, npmrc);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +45,7 @@ function writeRegistryToFile(registryUrl: string, fileLocation: string) {
|
||||||
: `registry=${registryUrl}`;
|
: `registry=${registryUrl}`;
|
||||||
newContents += `${authString}${os.EOL}${registryString}`;
|
newContents += `${authString}${os.EOL}${registryString}`;
|
||||||
fs.writeFileSync(fileLocation, newContents);
|
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
|
// 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');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue