Allow for alternate settings.xml file location

Use the m2-home to specify a new location for the settings.xml file
This commit is contained in:
Bryan Clark
2019-12-10 10:03:33 -08:00
parent 4757680fc9
commit ae11e1a1b6
4 changed files with 36 additions and 4 deletions

View File

@ -16,7 +16,12 @@ export async function configAuthentication(
console.log(
`creating ${SETTINGS_FILE} with server-id: ${id}, username: ${username}, and a password`
);
const directory: string = path.join(os.homedir(), M2_DIR);
// when an alternate m2 location is specified use only that location (no .m2 directory)
// otherwise use the home/.m2/ path
const directory: string = path.join(
core.getInput('m2-home') || os.homedir(),
core.getInput('m2-home') ? '' : M2_DIR
);
await io.mkdirP(directory);
core.debug(`created directory ${directory}`);
await write(directory, generate(id, username, password));