mirror of
https://github.com/crazy-max/ghaction-import-gpg.git
synced 2024-11-22 04:50:56 -05:00
Kill GnuPG agent at POST step
This commit is contained in:
parent
7f1aa5edc1
commit
3ff0e7f81d
5 changed files with 19 additions and 1 deletions
|
@ -18,7 +18,7 @@ If you are interested, [check out](https://git.io/Je09Y) my other :octocat: GitH
|
|||
* Allow to seed the internal cache of `gpg-agent` with provided passphrase
|
||||
* Enable signing for Git commits and tags
|
||||
* Configure and check committer info against GPG key
|
||||
* Purge imported GPG key and cache information from runner
|
||||
* Purge imported GPG key, cache information and kill agent from runner
|
||||
|
||||
## Usage
|
||||
|
||||
|
|
|
@ -180,4 +180,10 @@ describe('gpg', () => {
|
|||
await gpg.deleteKey(userInfo.fingerprint);
|
||||
});
|
||||
});
|
||||
|
||||
describe('killAgent', () => {
|
||||
it('kills GnuPG agent', async () => {
|
||||
await gpg.killAgent();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
5
dist/index.js
generated
vendored
5
dist/index.js
generated
vendored
|
@ -1092,6 +1092,8 @@ function cleanup() {
|
|||
core.info('🚿 Removing keys');
|
||||
const privateKey = yield openpgp.readPrivateKey(process.env.SIGNING_KEY);
|
||||
yield gpg.deleteKey(privateKey.fingerprint);
|
||||
core.info('💀 Killing GnuPG agent');
|
||||
yield gpg.killAgent();
|
||||
}
|
||||
catch (error) {
|
||||
core.warning(error.message);
|
||||
|
@ -1274,6 +1276,9 @@ exports.deleteKey = (fingerprint) => __awaiter(void 0, void 0, void 0, function*
|
|||
}
|
||||
});
|
||||
});
|
||||
exports.killAgent = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||
yield gpgConnectAgent('KILLAGENT');
|
||||
});
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
|
@ -163,3 +163,7 @@ export const deleteKey = async (fingerprint: string): Promise<void> => {
|
|||
}
|
||||
});
|
||||
};
|
||||
|
||||
export const killAgent = async (): Promise<void> => {
|
||||
await gpgConnectAgent('KILLAGENT');
|
||||
};
|
||||
|
|
|
@ -87,6 +87,9 @@ async function cleanup(): Promise<void> {
|
|||
core.info('🚿 Removing keys');
|
||||
const privateKey = await openpgp.readPrivateKey(process.env.SIGNING_KEY);
|
||||
await gpg.deleteKey(privateKey.fingerprint);
|
||||
|
||||
core.info('💀 Killing GnuPG agent');
|
||||
await gpg.killAgent();
|
||||
} catch (error) {
|
||||
core.warning(error.message);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue