diff --git a/dist/index.js b/dist/index.js index d94c7e24..57f52026 100644 --- a/dist/index.js +++ b/dist/index.js @@ -79,8 +79,11 @@ const toolCache = __importStar(__nccwpck_require__(7784)); async function setupKeys() { core.debug("Fetching verification keys"); let path = await toolCache.downloadTool("https://swift.org/keys/all-keys.asc"); + core.debug("Examining verification keys"); + await (0, exec_1.exec)(`file "${path}"`); + const isPlaintext = await (0, exec_1.exec)(`gunzip --test "${path}"`, undefined, { silent: true, ignoreReturnCode: true }); core.debug("Importing verification keys"); - await (0, exec_1.exec)(`gpg --import "${path}"`); + await (0, exec_1.exec)('bash', ['-c', `${isPlaintext ? "cat" : "zcat"} "${path}" | gpg --import`]); core.debug("Refreshing keys"); await refreshKeys(); } diff --git a/src/gpg.ts b/src/gpg.ts index 8a69ad87..68038744 100644 --- a/src/gpg.ts +++ b/src/gpg.ts @@ -8,8 +8,12 @@ export async function setupKeys() { "https://swift.org/keys/all-keys.asc" ); + core.debug("Examining verification keys"); + await exec(`file "${path}"`); + const isPlaintext = await exec(`gunzip --test "${path}"`, undefined, { silent: true, ignoreReturnCode: true }); + core.debug("Importing verification keys"); - await exec(`gpg --import "${path}"`); + await exec('bash', ['-c', `${isPlaintext ? "cat" : "zcat"} "${path}" | gpg --import`]); core.debug("Refreshing keys"); await refreshKeys();