Skip to content

Commit 8021376

Browse files
fix: only set WIN_CSC_LINK env when cert secret is configured
Empty WIN_CSC_LINK causes electron-builder to resolve it as the workspace root path, breaking the build. Now we only inject the signing env vars when the secret is actually present, so unsigned builds skip signing cleanly.
1 parent f8c684c commit 8021376

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,23 @@ jobs:
8484
-S apple-tool:,apple:,codesign: -s -k "temp-keychain-password" build.keychain
8585
rm certificate.p12
8686
87+
# Set Windows signing env only when the cert secret is actually configured.
88+
# Passing an empty WIN_CSC_LINK causes electron-builder to resolve it as
89+
# a relative path (the workspace root), which breaks the build.
90+
- name: Configure Windows code signing
91+
if: matrix.platform == 'win' && secrets.WIN_CSC_LINK != ''
92+
shell: pwsh
93+
run: |
94+
echo "WIN_CSC_LINK=${{ secrets.WIN_CSC_LINK }}" | Out-File -FilePath $env:GITHUB_ENV -Append
95+
echo "WIN_CSC_KEY_PASSWORD=${{ secrets.WIN_CSC_KEY_PASSWORD }}" | Out-File -FilePath $env:GITHUB_ENV -Append
96+
8797
- name: Build & package
8898
env:
8999
# macOS signing (no-op if secrets absent)
90100
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
91101
APPLE_ID: ${{ secrets.APPLE_ID }}
92102
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
93103
CSC_IDENTITY_AUTO_DISCOVERY: ${{ secrets.APPLE_CERTIFICATE != '' && 'true' || 'false' }}
94-
# Windows signing — skipped automatically when secrets are absent
95-
WIN_CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
96-
WIN_CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
97104
# GitHub token for electron-updater publish
98105
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99106
run: npm run build:${{ matrix.platform }}

0 commit comments

Comments
 (0)