generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #5 DMD does not use HTTPS for download links, thus using GPG signature is necessary to avoid MitM. LDC currently does not need/provide those.
- Loading branch information
Mihails Strasuns
committed
Nov 1, 2019
1 parent
afc4e8a
commit f901112
Showing
7 changed files
with
68 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; | ||
result["default"] = mod; | ||
return result; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tc = __importStar(require("@actions/tool-cache")); | ||
const util_1 = require("util"); | ||
const child_process_1 = require("child_process"); | ||
const aexec = util_1.promisify(child_process_1.exec); | ||
function verify(file_path, sig_url) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const keyring = yield tc.downloadTool("https://dlang.org/d-keyring.gpg"); | ||
const sig_path = yield tc.downloadTool(sig_url); | ||
// Will throw on non-zero exit code: | ||
const result = yield aexec(`gpg --verify --keyring ${keyring} --trust-model=direct --no-default-keyring ${sig_path} ${file_path}`); | ||
console.log(result.stderr); | ||
}); | ||
} | ||
exports.verify = verify; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as tc from '@actions/tool-cache'; | ||
import { promisify } from 'util'; | ||
import { exec } from 'child_process'; | ||
import { rename } from 'fs'; | ||
|
||
const aexec = promisify(exec); | ||
|
||
export async function verify(file_path: string, sig_url: string) { | ||
const keyring = await tc.downloadTool("https://dlang.org/d-keyring.gpg"); | ||
const sig_path = await tc.downloadTool(sig_url); | ||
// Will throw on non-zero exit code: | ||
const result = await aexec( | ||
`gpg --verify --keyring ${keyring} --trust-model=direct --no-default-keyring ${sig_path} ${file_path}`); | ||
console.log(result.stderr); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters