mirror of
https://github.com/actions/setup-java.git
synced 2026-11-16 01:54:59 +00:00
Import Maven signing keys into an isolated GPG home (#1214)
* Isolate Maven signing keys Import signing keys into an action-owned temporary GPG home, export GNUPGHOME, and remove the owned directory in the post action. Cover import failure, multiple keys and invocations, unrelated keyrings, missing state, and Windows path conversion. Co-authored-by: Copilot App <[email protected]> * Fix cleanup state assertion Account for isolated GPG-home cleanup when cache saving is disabled. Co-authored-by: Copilot App <[email protected]> * Update generated action bundles Apply repository formatting and commit the setup and cleanup bundles produced by the validated Node 24 build. Co-authored-by: Copilot App <[email protected]> * Address isolated GPG home review feedback Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: Copilot App <[email protected]> Co-authored-by: Bruno Borges <[email protected]>
This commit is contained in:
17 files changed
+715
-309
No files matched your search
+14
-14
@@ -8,19 +8,19 @@ import {
|
||||
} from './util.js';
|
||||
import {fileURLToPath} from 'url';
|
||||
|
||||
async function removePrivateKeyFromKeychain() {
|
||||
if (core.getInput(constants.INPUT_GPG_PRIVATE_KEY, {required: false})) {
|
||||
core.info('Removing private key from keychain');
|
||||
try {
|
||||
const keyFingerprint = core.getState(
|
||||
constants.STATE_GPG_PRIVATE_KEY_FINGERPRINT
|
||||
);
|
||||
await gpg.deleteKey(keyFingerprint);
|
||||
} catch (error) {
|
||||
core.setFailed(
|
||||
`Failed to remove private key due to: ${(error as Error).message}`
|
||||
);
|
||||
}
|
||||
async function removeGpgHome() {
|
||||
const gpgHome = core.getState(constants.STATE_GPG_HOME);
|
||||
if (!gpgHome) {
|
||||
return;
|
||||
}
|
||||
|
||||
core.info('Removing private key from isolated GPG home');
|
||||
try {
|
||||
await gpg.removeGpgHome(gpgHome);
|
||||
} catch (error) {
|
||||
core.setFailed(
|
||||
`Failed to remove isolated GPG home due to: ${(error as Error).message}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ async function ignoreError(promise: Promise<void>) {
|
||||
}
|
||||
|
||||
export async function run() {
|
||||
await removePrivateKeyFromKeychain();
|
||||
await removeGpgHome();
|
||||
await ignoreError(saveCaches());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user