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") +}