Skip to content

Commit

Permalink
fix(windows,code-sign): cannot sign binary files in Github Actions
Browse files Browse the repository at this point in the history
Fixed: #7729 #8055

Signed-off-by: Kevin Cui <[email protected]>
  • Loading branch information
BlackHole1 committed Jul 30, 2024
1 parent 977acaf commit cd16794
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-news-stare.md
Original file line number Diff line number Diff line change
@@ -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
13 changes: 10 additions & 3 deletions packages/app-builder-lib/src/codeSign/windowsCodeSign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ export interface CertificateFromStoreInfo {
export async function getCertificateFromStoreInfo(options: WindowsConfiguration, vm: VmManager): Promise<CertificateFromStoreInfo> {
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",
Expand Down Expand Up @@ -319,3 +319,10 @@ async function getToolPath(isWin = process.platform === "win32"): Promise<ToolIn
return { path: path.join(vendorPath, process.platform, "osslsigncode") }
}
}

async function getPSCmd(vm: VmManager): Promise<string> {
return await vm
.exec("powershell.exe", ["-NoProfile", "-NonInteractive", "-Command", `Get-Command pwsh.exe`])
.then(() => "pwsh.exe")
.catch(() => "powershell.exe")
}

0 comments on commit cd16794

Please sign in to comment.