Display GnuPG info

This commit is contained in:
CrazyMax 2020-05-03 21:33:19 +02:00
parent f5631011c6
commit cd56930939
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
2 changed files with 20 additions and 16 deletions

18
dist/index.js generated vendored
View file

@ -108,8 +108,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470)); const core = __importStar(__webpack_require__(470));
const gpg_1 = __webpack_require__(207); const gpg = __importStar(__webpack_require__(207));
const openpgp_1 = __webpack_require__(781); const openpgp = __importStar(__webpack_require__(781));
const stateHelper = __importStar(__webpack_require__(153)); const stateHelper = __importStar(__webpack_require__(153));
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@ -118,16 +118,18 @@ function run() {
core.setFailed('Signing key required'); core.setFailed('Signing key required');
return; return;
} }
core.debug(`SIGNING_KEY: ${process.env.SIGNING_KEY}`); core.info('📣 GnuPG info');
core.debug(`PASSPHRASE: ${process.env.PASSPHRASE}`); const version = yield gpg.getVersion();
core.info(`GnuPG version: ${version.gnupg}`);
core.info(`libgcrypt version: ${version.libgcrypt}`);
core.info('🔮 Checking signing key...'); core.info('🔮 Checking signing key...');
const privateKey = yield openpgp_1.readPrivateKey(process.env.SIGNING_KEY); const privateKey = yield openpgp.readPrivateKey(process.env.SIGNING_KEY);
core.debug(`key.fingerprint=${privateKey.fingerprint}`); core.debug(`key.fingerprint=${privateKey.fingerprint}`);
core.debug(`key.keyID=${privateKey.keyID}`); core.debug(`key.keyID=${privateKey.keyID}`);
core.debug(`key.userID=${privateKey.userID}`); core.debug(`key.userID=${privateKey.userID}`);
core.debug(`key.creationTime=${privateKey.creationTime}`); core.debug(`key.creationTime=${privateKey.creationTime}`);
core.info('🔑 Importing secret key...'); core.info('🔑 Importing secret key...');
yield gpg_1.importKey(process.env.SIGNING_KEY); yield gpg.importKey(process.env.SIGNING_KEY);
} }
catch (error) { catch (error) {
core.setFailed(error.message); core.setFailed(error.message);
@ -142,8 +144,8 @@ function cleanup() {
} }
try { try {
core.info('🚿 Removing keys from GnuPG...'); core.info('🚿 Removing keys from GnuPG...');
const privateKey = yield openpgp_1.readPrivateKey(process.env.SIGNING_KEY); const privateKey = yield openpgp.readPrivateKey(process.env.SIGNING_KEY);
yield gpg_1.deleteKey(privateKey.fingerprint); yield gpg.deleteKey(privateKey.fingerprint);
} }
catch (error) { catch (error) {
core.warning(error.message); core.warning(error.message);

View file

@ -1,6 +1,6 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import {deleteKey, importKey} from './gpg'; import * as gpg from './gpg';
import {readPrivateKey} from './openpgp'; import * as openpgp from './openpgp';
import * as stateHelper from './state-helper'; import * as stateHelper from './state-helper';
async function run(): Promise<void> { async function run(): Promise<void> {
@ -10,18 +10,20 @@ async function run(): Promise<void> {
return; return;
} }
core.debug(`SIGNING_KEY: ${process.env.SIGNING_KEY}`); core.info('📣 GnuPG info');
core.debug(`PASSPHRASE: ${process.env.PASSPHRASE}`); const version = await gpg.getVersion();
core.info(`GnuPG version: ${version.gnupg}`);
core.info(`libgcrypt version: ${version.libgcrypt}`);
core.info('🔮 Checking signing key...'); core.info('🔮 Checking signing key...');
const privateKey = await readPrivateKey(process.env.SIGNING_KEY); const privateKey = await openpgp.readPrivateKey(process.env.SIGNING_KEY);
core.debug(`key.fingerprint=${privateKey.fingerprint}`); core.debug(`key.fingerprint=${privateKey.fingerprint}`);
core.debug(`key.keyID=${privateKey.keyID}`); core.debug(`key.keyID=${privateKey.keyID}`);
core.debug(`key.userID=${privateKey.userID}`); core.debug(`key.userID=${privateKey.userID}`);
core.debug(`key.creationTime=${privateKey.creationTime}`); core.debug(`key.creationTime=${privateKey.creationTime}`);
core.info('🔑 Importing secret key...'); core.info('🔑 Importing secret key...');
await importKey(process.env.SIGNING_KEY); await gpg.importKey(process.env.SIGNING_KEY);
} catch (error) { } catch (error) {
core.setFailed(error.message); core.setFailed(error.message);
} }
@ -34,8 +36,8 @@ async function cleanup(): Promise<void> {
} }
try { try {
core.info('🚿 Removing keys from GnuPG...'); core.info('🚿 Removing keys from GnuPG...');
const privateKey = await readPrivateKey(process.env.SIGNING_KEY); const privateKey = await openpgp.readPrivateKey(process.env.SIGNING_KEY);
await deleteKey(privateKey.fingerprint); await gpg.deleteKey(privateKey.fingerprint);
} catch (error) { } catch (error) {
core.warning(error.message); core.warning(error.message);
} }