Skip to content

Commit 087423a

Browse files
committed
fix: GitHub Actions release workflow signing steps — use runtime guard instead of if: expression
1 parent 1981ffc commit 087423a

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,16 @@ jobs:
6060
6161
# ── 6. Code-sign exe (skipped if secret not configured) ──────────────
6262
- name: Sign executable
63-
if: ${{ secrets.CODESIGN_CERT_BASE64 != '' }}
6463
shell: pwsh
6564
env:
6665
CERT_BASE64: ${{ secrets.CODESIGN_CERT_BASE64 }}
6766
CERT_PASSWORD: ${{ secrets.CODESIGN_CERT_PASSWORD }}
6867
run: |
68+
# Skip if no certificate secret provided
69+
if ([string]::IsNullOrWhiteSpace($env:CERT_BASE64)) {
70+
Write-Host "No code signing certificate — skipping exe signing."
71+
exit 0
72+
}
6973
$certBytes = [Convert]::FromBase64String($env:CERT_BASE64)
7074
$certPath = "codesign.pfx"
7175
[IO.File]::WriteAllBytes($certPath, $certBytes)
@@ -77,7 +81,7 @@ jobs:
7781
Sort-Object FullName -Descending |
7882
Select-Object -First 1 -ExpandProperty FullName
7983
80-
if (-not $signtool) { Write-Error "signtool.exe not found"; exit 1 }
84+
if (-not $signtool) { Write-Warning "signtool.exe not found — skipping signing"; exit 0 }
8185
8286
& $signtool sign `
8387
/fd sha256 `
@@ -134,14 +138,18 @@ jobs:
134138
$setup = Get-ChildItem installer\Output -Filter "*.exe" | Select-Object -First 1
135139
Copy-Item $setup.FullName "${{ env.INSTALLER_NAME }}"
136140
137-
# ── 10. Sign installer ───────────────────────────────────────────────
141+
# ── 10. Sign installer ───────────────────────────────────────────────
138142
- name: Sign installer
139-
if: ${{ secrets.CODESIGN_CERT_BASE64 != '' }}
140143
shell: pwsh
141144
env:
142145
CERT_BASE64: ${{ secrets.CODESIGN_CERT_BASE64 }}
143146
CERT_PASSWORD: ${{ secrets.CODESIGN_CERT_PASSWORD }}
144147
run: |
148+
# Skip if no certificate secret provided
149+
if ([string]::IsNullOrWhiteSpace($env:CERT_BASE64)) {
150+
Write-Host "No code signing certificate — skipping installer signing."
151+
exit 0
152+
}
145153
$certBytes = [Convert]::FromBase64String($env:CERT_BASE64)
146154
$certPath = "codesign.pfx"
147155
[IO.File]::WriteAllBytes($certPath, $certBytes)
@@ -152,6 +160,8 @@ jobs:
152160
Sort-Object FullName -Descending |
153161
Select-Object -First 1 -ExpandProperty FullName
154162
163+
if (-not $signtool) { Write-Warning "signtool.exe not found — skipping signing"; exit 0 }
164+
155165
& $signtool sign `
156166
/fd sha256 `
157167
/tr http://timestamp.digicert.com `

0 commit comments

Comments
 (0)