From cd16794d52a8787dfc430ee91ef724f8eae5a902 Mon Sep 17 00:00:00 2001 From: Kevin Cui Date: Tue, 30 Jul 2024 14:54:11 +0800 Subject: [PATCH] fix(windows,code-sign): cannot sign binary files in Github Actions Fixed: #7729 #8055 Signed-off-by: Kevin Cui --- .changeset/good-news-stare.md | 5 +++++ .../app-builder-lib/src/codeSign/windowsCodeSign.ts | 13 ++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 .changeset/good-news-stare.md diff --git a/.changeset/good-news-stare.md b/.changeset/good-news-stare.md new file mode 100644 index 00000000000..a3ec9a5391a --- /dev/null +++ b/.changeset/good-news-stare.md @@ -0,0 +1,5 @@ +--- +"app-builder-lib": patch +--- + +Fix the issue of being unable to sign binary files in the Windows runner on Github Actions diff --git a/packages/app-builder-lib/src/codeSign/windowsCodeSign.ts b/packages/app-builder-lib/src/codeSign/windowsCodeSign.ts index 896aa87a47b..f8a03c55ca5 100644 --- a/packages/app-builder-lib/src/codeSign/windowsCodeSign.ts +++ b/packages/app-builder-lib/src/codeSign/windowsCodeSign.ts @@ -110,9 +110,9 @@ export interface CertificateFromStoreInfo { export async function getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise { const certificateSubjectName = options.certificateSubjectName const certificateSha1 = options.certificateSha1 ? options.certificateSha1.toUpperCase() : options.certificateSha1 - // ExcludeProperty doesn't work, so, we cannot exclude RawData, it is ok - // powershell can return object if the only item - const rawResult = await vm.exec("powershell.exe", [ + + const ps = await getPSCmd(vm) + const rawResult = await vm.exec(ps, [ "-NoProfile", "-NonInteractive", "-Command", @@ -319,3 +319,10 @@ async function getToolPath(isWin = process.platform === "win32"): Promise { + return await vm + .exec("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", `Get-Command pwsh.exe`]) + .then(() => "pwsh.exe") + .catch(() => "powershell.exe") +}