()
| 11 | import {getBooleanInput} from './util'; |
| 12 | |
| 13 | export async function configureAuthentication() { |
| 14 | const id = core.getInput(constants.INPUT_SERVER_ID); |
| 15 | const username = core.getInput(constants.INPUT_SERVER_USERNAME); |
| 16 | const password = core.getInput(constants.INPUT_SERVER_PASSWORD); |
| 17 | const settingsDirectory = |
| 18 | core.getInput(constants.INPUT_SETTINGS_PATH) || |
| 19 | path.join(os.homedir(), constants.M2_DIR); |
| 20 | const overwriteSettings = getBooleanInput( |
| 21 | constants.INPUT_OVERWRITE_SETTINGS, |
| 22 | true |
| 23 | ); |
| 24 | const gpgPrivateKey = |
| 25 | core.getInput(constants.INPUT_GPG_PRIVATE_KEY) || |
| 26 | constants.INPUT_DEFAULT_GPG_PRIVATE_KEY; |
| 27 | const gpgPassphrase = |
| 28 | core.getInput(constants.INPUT_GPG_PASSPHRASE) || |
| 29 | (gpgPrivateKey ? constants.INPUT_DEFAULT_GPG_PASSPHRASE : undefined); |
| 30 | |
| 31 | if (gpgPrivateKey) { |
| 32 | core.setSecret(gpgPrivateKey); |
| 33 | } |
| 34 | |
| 35 | await createAuthenticationSettings( |
| 36 | id, |
| 37 | username, |
| 38 | password, |
| 39 | settingsDirectory, |
| 40 | overwriteSettings, |
| 41 | gpgPassphrase |
| 42 | ); |
| 43 | |
| 44 | if (gpgPrivateKey) { |
| 45 | core.info('Importing private gpg key'); |
| 46 | const keyFingerprint = (await gpg.importKey(gpgPrivateKey)) || ''; |
| 47 | core.saveState(constants.STATE_GPG_PRIVATE_KEY_FINGERPRINT, keyFingerprint); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | export async function createAuthenticationSettings( |
| 52 | id: string, |
nothing calls this directly
no test coverage detected