Import Maven signing keys into an isolated GPG home - #1214
Conversation
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 <223556219+Copilot@users.noreply.github.com>
Account for isolated GPG-home cleanup when cache saving is disabled. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Apply repository formatting and commit the setup and cleanup bundles produced by the validated Node 24 build. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates actions/setup-java to import Maven signing keys into an action-owned, isolated temporary GPG home (exported via GNUPGHOME) and to clean up by deleting the owned GPG home directory instead of deleting fingerprints from the runner’s default keyring.
Changes:
- Create a per-invocation temporary GPG home with restrictive permissions and import
gpg-private-keyinto that isolated keyring. - Persist the owned GPG home path as post-action state and remove the directory during cleanup with ownership/safety checks.
- Expand test coverage and update docs/action metadata to reflect isolated key handling; regenerate
dist/bundles.
Show a summary per file
| File | Description |
|---|---|
| src/gpg.ts | Adds isolated GPG home creation, key import into that home, and safe removal of action-owned homes. |
| src/constants.ts | Switches cleanup state from fingerprint-based to gpg-home. |
| src/cleanup-java.ts | Cleans up by removing the persisted isolated GPG home directory instead of deleting keys by fingerprint. |
| src/auth.ts | Imports key into isolated home, saves gpg-home state, exports GNUPGHOME. |
| README.md | Updates input description to reflect isolated temporary keyring behavior. |
| docs/advanced-usage.md | Updates advanced docs to describe isolated keyring import and cleanup behavior. |
| action.yml | Updates gpg-private-key input description to mention isolated temporary keyring. |
| tests/gpg.test.ts | Adds coverage for isolated home creation, import failure cleanup, multi-key input, and safe home removal. |
| tests/distributors/temurin-installer.test.ts | Updates GPG mock API to match new cleanup function name. |
| tests/distributors/microsoft-installer.test.ts | Updates GPG mock API to match new cleanup function name. |
| tests/cleanup-java.test.ts | Adds coverage for isolated home cleanup, idempotency, and missing state behavior. |
| tests/auth.test.ts | Adds coverage for persisting/exporting isolated home and cleanup on export failure. |
| dist/setup/index.js | Regenerated bundle reflecting new state constant and GPG isolation changes. |
| dist/setup/81.index.js | Regenerated setup bundle chunk reflecting new GPG home handling and exports. |
| dist/setup/463.index.js | Regenerated setup bundle chunk reflecting new GPG home handling and exports. |
| dist/setup/220.index.js | Regenerated setup bundle chunk reflecting new GPG home handling and exports. |
| dist/cleanup/index.js | Regenerated cleanup bundle reflecting new state constant and cleanup behavior. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 12/17 changed files
- Comments generated: 1
- Review effort level: Lite
|
Nice work — this matches how I'd approach #1211 almost exactly (isolated home, 1.
Best-effort kill before removal handles both: try {
await exec.exec(
'gpgconf',
['--homedir', toGpgPath(resolvedGpgHome), '--kill', 'gpg-agent'],
{silent: true, ignoreReturnCode: true}
);
} catch {
// gpgconf may not be present; removal is still attempted
}
await io.rmRF(resolvedGpgHome);2.
The |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Addressed both cleanup follow-ups in 53f7386: |
Summary
GNUPGHOMEValidation
npm run formatnpm run lintnpm run buildnpm test(41 suites, 1,322 tests)Closes #1211