mirror of
https://github.com/crazy-max/ghaction-import-gpg.git
synced 2024-11-22 13:00:56 -05:00
Windows runner uses Git GnuPG
This commit is contained in:
parent
28569120f0
commit
e124e7303a
3 changed files with 26 additions and 19 deletions
20
dist/index.js
generated
vendored
20
dist/index.js
generated
vendored
|
@ -1016,7 +1016,6 @@ const gpg = __importStar(__webpack_require__(207));
|
||||||
const openpgp = __importStar(__webpack_require__(781));
|
const openpgp = __importStar(__webpack_require__(781));
|
||||||
const stateHelper = __importStar(__webpack_require__(153));
|
const stateHelper = __importStar(__webpack_require__(153));
|
||||||
const exec = __importStar(__webpack_require__(986));
|
const exec = __importStar(__webpack_require__(986));
|
||||||
const os = __importStar(__webpack_require__(87));
|
|
||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
|
@ -1024,11 +1023,6 @@ function run() {
|
||||||
core.setFailed('Signing key required');
|
core.setFailed('Signing key required');
|
||||||
return;
|
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');
|
core.info('📣 GnuPG info');
|
||||||
yield exec.exec('which', ['gpg']);
|
yield exec.exec('which', ['gpg']);
|
||||||
const version = yield gpg.getVersion();
|
const version = yield gpg.getVersion();
|
||||||
|
@ -1125,10 +1119,18 @@ allow-preset-passphrase`;
|
||||||
const getGpgPresetPassphrasePath = () => __awaiter(void 0, void 0, void 0, function* () {
|
const getGpgPresetPassphrasePath = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
const { libexecdir: libexecdir } = yield exports.getDirs();
|
const { libexecdir: libexecdir } = yield exports.getDirs();
|
||||||
let gpgPresetPassphrasePath = path.join(libexecdir, 'gpg-preset-passphrase');
|
let gpgPresetPassphrasePath = path.join(libexecdir, 'gpg-preset-passphrase');
|
||||||
if (os.platform() == 'win32' && !gpgPresetPassphrasePath.includes(':')) {
|
if (yield fs.existsSync(gpgPresetPassphrasePath)) {
|
||||||
gpgPresetPassphrasePath = path.join(process.env.HOMEDRIVE || '', libexecdir, 'gpg-preset-passphrase.exe');
|
return gpgPresetPassphrasePath;
|
||||||
}
|
}
|
||||||
return gpgPresetPassphrasePath;
|
gpgPresetPassphrasePath = path.join(process.env.HOMEDRIVE || '', libexecdir, 'gpg-preset-passphrase.exe');
|
||||||
|
if (yield fs.existsSync(gpgPresetPassphrasePath)) {
|
||||||
|
return gpgPresetPassphrasePath;
|
||||||
|
}
|
||||||
|
gpgPresetPassphrasePath = path.join(`C:\\Program Files\\Git`, libexecdir, 'gpg-preset-passphrase.exe');
|
||||||
|
if (yield fs.existsSync(gpgPresetPassphrasePath)) {
|
||||||
|
return gpgPresetPassphrasePath;
|
||||||
|
}
|
||||||
|
throw new Error('gpg-preset-passphrase not found');
|
||||||
});
|
});
|
||||||
const getGnupgHome = () => __awaiter(void 0, void 0, void 0, function* () {
|
const getGnupgHome = () => __awaiter(void 0, void 0, void 0, function* () {
|
||||||
if (process.env.GNUPGHOME) {
|
if (process.env.GNUPGHOME) {
|
||||||
|
|
18
src/gpg.ts
18
src/gpg.ts
|
@ -21,11 +21,23 @@ export interface Dirs {
|
||||||
|
|
||||||
const getGpgPresetPassphrasePath = async (): Promise<string> => {
|
const getGpgPresetPassphrasePath = async (): Promise<string> => {
|
||||||
const {libexecdir: libexecdir} = await getDirs();
|
const {libexecdir: libexecdir} = await getDirs();
|
||||||
|
|
||||||
let gpgPresetPassphrasePath = path.join(libexecdir, 'gpg-preset-passphrase');
|
let gpgPresetPassphrasePath = path.join(libexecdir, 'gpg-preset-passphrase');
|
||||||
if (os.platform() == 'win32' && !gpgPresetPassphrasePath.includes(':')) {
|
if (await fs.existsSync(gpgPresetPassphrasePath)) {
|
||||||
gpgPresetPassphrasePath = path.join(process.env.HOMEDRIVE || '', libexecdir, 'gpg-preset-passphrase.exe');
|
return gpgPresetPassphrasePath;
|
||||||
}
|
}
|
||||||
return gpgPresetPassphrasePath;
|
|
||||||
|
gpgPresetPassphrasePath = path.join(process.env.HOMEDRIVE || '', libexecdir, 'gpg-preset-passphrase.exe');
|
||||||
|
if (await fs.existsSync(gpgPresetPassphrasePath)) {
|
||||||
|
return gpgPresetPassphrasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
gpgPresetPassphrasePath = path.join(`C:\\Program Files\\Git`, libexecdir, 'gpg-preset-passphrase.exe');
|
||||||
|
if (await fs.existsSync(gpgPresetPassphrasePath)) {
|
||||||
|
return gpgPresetPassphrasePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new Error('gpg-preset-passphrase not found');
|
||||||
};
|
};
|
||||||
|
|
||||||
const getGnupgHome = async (): Promise<string> => {
|
const getGnupgHome = async (): Promise<string> => {
|
||||||
|
|
|
@ -3,7 +3,6 @@ import * as gpg from './gpg';
|
||||||
import * as openpgp from './openpgp';
|
import * as openpgp from './openpgp';
|
||||||
import * as stateHelper from './state-helper';
|
import * as stateHelper from './state-helper';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import * as os from 'os';
|
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
@ -12,12 +11,6 @@ async function run(): Promise<void> {
|
||||||
return;
|
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');
|
core.info('📣 GnuPG info');
|
||||||
await exec.exec('which', ['gpg']);
|
await exec.exec('which', ['gpg']);
|
||||||
const version = await gpg.getVersion();
|
const version = await gpg.getVersion();
|
||||||
|
|
Loading…
Reference in a new issue