From 28569120f0e199a1adfd514c49e7386ea37349e3 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Mon, 4 May 2020 19:29:58 +0200 Subject: [PATCH] Use GnuPG Chocolatey on Windows --- dist/index.js | 6 ++++++ src/main.ts | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/dist/index.js b/dist/index.js index cb6ab77..c70b8d1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1016,6 +1016,7 @@ const gpg = __importStar(__webpack_require__(207)); const openpgp = __importStar(__webpack_require__(781)); const stateHelper = __importStar(__webpack_require__(153)); const exec = __importStar(__webpack_require__(986)); +const os = __importStar(__webpack_require__(87)); function run() { return __awaiter(this, void 0, void 0, function* () { try { @@ -1023,6 +1024,11 @@ function run() { core.setFailed('Signing key required'); return; } + if (os.platform() == 'win32') { + core.info('🏃 Installing GnuPG...'); + yield exec.exec(`choco feature enable -n=allowGlobalConfirmation`); + yield exec.exec(`choco install gnupg`); + } core.info('📣 GnuPG info'); yield exec.exec('which', ['gpg']); const version = yield gpg.getVersion(); diff --git a/src/main.ts b/src/main.ts index ace49c2..bbe4941 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,6 +3,7 @@ import * as gpg from './gpg'; import * as openpgp from './openpgp'; import * as stateHelper from './state-helper'; import * as exec from '@actions/exec'; +import * as os from 'os'; async function run(): Promise { try { @@ -11,6 +12,12 @@ async function run(): Promise { return; } + if (os.platform() == 'win32') { + core.info('🏃 Installing GnuPG...'); + await exec.exec(`choco feature enable -n=allowGlobalConfirmation`); + await exec.exec(`choco install gnupg`); + } + core.info('📣 GnuPG info'); await exec.exec('which', ['gpg']); const version = await gpg.getVersion();