Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/common/codesign.ts
3520 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { $, ProcessPromise } from 'zx';
7
8
export function printBanner(title: string) {
9
title = `${title} (${new Date().toISOString()})`;
10
11
console.log('\n');
12
console.log('#'.repeat(75));
13
console.log(`# ${title.padEnd(71)} #`);
14
console.log('#'.repeat(75));
15
console.log('\n');
16
}
17
18
export async function streamProcessOutputAndCheckResult(name: string, promise: ProcessPromise): Promise<void> {
19
const result = await promise.pipe(process.stdout);
20
if (result.ok) {
21
console.log(`\n${name} completed successfully. Duration: ${result.duration} ms`);
22
return;
23
}
24
25
throw new Error(`${name} failed: ${result.stderr}`);
26
}
27
28
export function spawnCodesignProcess(esrpCliDLLPath: string, type: 'sign-windows' | 'sign-windows-appx' | 'sign-pgp' | 'sign-darwin' | 'notarize-darwin', folder: string, glob: string): ProcessPromise {
29
return $`node build/azure-pipelines/common/sign ${esrpCliDLLPath} ${type} ${folder} ${glob}`;
30
}
31
32