Skip to content

Commit e789b61

Browse files
SFARPakcursoragent
andcommitted
fix: avoid build-binaries workflow parse failures
Replace secret-based step conditions with runtime guards so the workflow validates correctly and skips signing setup cleanly when cert secrets are not configured. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 384b5df commit e789b61

1 file changed

Lines changed: 24 additions & 7 deletions

File tree

.github/workflows/build-binaries.yml

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,35 +43,52 @@ jobs:
4343
run: npm ci --no-audit --no-fund --progress=false
4444

4545
- name: Add macOS certificate
46-
if: contains(matrix.os.name, 'macos') && secrets.MACOS_CERT_P12 != ''
46+
if: contains(matrix.os.name, 'macos')
4747
env:
4848
MACOS_CERT_P12: ${{ secrets.MACOS_CERT_P12 }}
4949
MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
50-
run: chmod +x tools/add-macos-cert.sh && . ./tools/add-macos-cert.sh
50+
run: |
51+
if [ -z "${MACOS_CERT_P12}" ]; then
52+
echo "No macOS signing certificate configured; skipping certificate setup."
53+
exit 0
54+
fi
55+
chmod +x tools/add-macos-cert.sh && . ./tools/add-macos-cert.sh
5156
5257
# Windows certificate setup
5358
- name: Set up certificate (Windows)
54-
if: contains(matrix.os.name, 'windows') && secrets.SM_CLIENT_CERT_FILE_B64 != ''
59+
if: contains(matrix.os.name, 'windows')
60+
env:
61+
SM_CLIENT_CERT_FILE_B64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}
5562
run: |
56-
echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12
63+
if [ -z "${SM_CLIENT_CERT_FILE_B64}" ]; then
64+
echo "No Windows signing certificate configured; skipping certificate setup."
65+
exit 0
66+
fi
67+
echo "${SM_CLIENT_CERT_FILE_B64}" | base64 --decode > /d/Certificate_pkcs12.p12
5768
shell: bash
5869

5970
- name: Set Windows signing variables
60-
if: contains(matrix.os.name, 'windows') && secrets.SM_CLIENT_CERT_FILE_B64 != ''
71+
if: contains(matrix.os.name, 'windows')
72+
env:
73+
SM_CLIENT_CERT_FILE_B64: ${{ secrets.SM_CLIENT_CERT_FILE_B64 }}
6174
id: variables
6275
run: |
76+
if [ -z "${SM_CLIENT_CERT_FILE_B64}" ]; then
77+
echo "No Windows signing certificate configured; skipping signing env variables."
78+
exit 0
79+
fi
6380
echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV"
6481
echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV"
6582
echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV"
6683
echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV"
6784
shell: bash
6885

6986
- name: Code signing with Software Trust Manager (Windows)
70-
if: contains(matrix.os.name, 'windows') && secrets.SM_CLIENT_CERT_FILE_B64 != ''
87+
if: contains(matrix.os.name, 'windows') && env.SM_CLIENT_CERT_FILE != ''
7188
uses: digicert/ssm-code-signing@v1.1.0
7289

7390
- name: Sync certificate (Windows)
74-
if: contains(matrix.os.name, 'windows') && secrets.SM_CLIENT_CERT_FILE_B64 != ''
91+
if: contains(matrix.os.name, 'windows') && env.SM_CLIENT_CERT_FILE != ''
7592
run: |
7693
smctl windows certsync --keypair-alias=${{ secrets.DIGICERT_KEYPAIR_ALIAS }}
7794
shell: bash

0 commit comments

Comments
 (0)