Skip to content

Commit 77f30a7

Browse files
committed
fix: use job-level env vars for conditional Apple signing
GitHub Actions doesn't allow accessing secrets context directly in step-level 'if' conditions. This fix uses job-level environment variables to expose boolean flags from secrets, which can then be checked in step conditions.
1 parent 2bbfde9 commit 77f30a7

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ jobs:
4545
name: Build Binaries for ${{ matrix.target }}
4646
needs: validate_version
4747
runs-on: ${{ matrix.os }}
48+
env:
49+
APPLE_SIGNING_ENABLED: ${{ secrets.APPLE_CERTIFICATE_BASE64 != '' }}
50+
APPLE_NOTARIZATION_ENABLED: ${{ secrets.APPLE_API_KEY_BASE64 != '' }}
4851
strategy:
4952
matrix:
5053
include:
@@ -101,7 +104,7 @@ jobs:
101104
fi
102105
103106
- name: Import Apple Certificate (macOS only)
104-
if: ${{ (matrix.os == 'macos-latest' || matrix.os == 'macos-14') && secrets.APPLE_CERTIFICATE_BASE64 != '' }}
107+
if: (matrix.os == 'macos-latest' || matrix.os == 'macos-14') && env.APPLE_SIGNING_ENABLED == 'true'
105108
env:
106109
APPLE_CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
107110
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
@@ -136,7 +139,7 @@ jobs:
136139
rm certificate.p12 DeveloperIDG2CA.cer AppleWWDRCAG3.cer
137140
138141
- name: Code Sign Binary (macOS only)
139-
if: ${{ (matrix.os == 'macos-latest' || matrix.os == 'macos-14') && secrets.APPLE_CERTIFICATE_BASE64 != '' }}
142+
if: (matrix.os == 'macos-latest' || matrix.os == 'macos-14') && env.APPLE_SIGNING_ENABLED == 'true'
140143
env:
141144
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
142145
run: |
@@ -155,7 +158,7 @@ jobs:
155158
/usr/bin/codesign --verify --verbose ./target/${{ matrix.target }}/release/${{ matrix.output_name }}
156159
157160
- name: Notarize Binary (macOS only)
158-
if: ${{ (matrix.os == 'macos-latest' || matrix.os == 'macos-14') && secrets.APPLE_API_KEY_BASE64 != '' }}
161+
if: (matrix.os == 'macos-latest' || matrix.os == 'macos-14') && env.APPLE_NOTARIZATION_ENABLED == 'true'
159162
env:
160163
APPLE_API_KEY_BASE64: ${{ secrets.APPLE_API_KEY_BASE64 }}
161164
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}

0 commit comments

Comments
 (0)