Path: blob/main/build/azure-pipelines/common/codesign.ts
3520 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { $, ProcessPromise } from 'zx';67export function printBanner(title: string) {8title = `${title} (${new Date().toISOString()})`;910console.log('\n');11console.log('#'.repeat(75));12console.log(`# ${title.padEnd(71)} #`);13console.log('#'.repeat(75));14console.log('\n');15}1617export async function streamProcessOutputAndCheckResult(name: string, promise: ProcessPromise): Promise<void> {18const result = await promise.pipe(process.stdout);19if (result.ok) {20console.log(`\n${name} completed successfully. Duration: ${result.duration} ms`);21return;22}2324throw new Error(`${name} failed: ${result.stderr}`);25}2627export function spawnCodesignProcess(esrpCliDLLPath: string, type: 'sign-windows' | 'sign-windows-appx' | 'sign-pgp' | 'sign-darwin' | 'notarize-darwin', folder: string, glob: string): ProcessPromise {28return $`node build/azure-pipelines/common/sign ${esrpCliDLLPath} ${type} ${folder} ${glob}`;29}303132