Skip to content

Commit e33d3ac

Browse files
build(macos): Sign macOS binaries
Closes #1882
1 parent c7919f5 commit e33d3ac

File tree

1 file changed

+60
-3
lines changed

1 file changed

+60
-3
lines changed

.github/workflows/build.yml

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ jobs:
7979

8080
- uses: actions/upload-artifact@v4
8181
with:
82-
name: artifact-bin-macos-${{ matrix.arch }}
82+
name: unsigned-bin-macos-${{ matrix.arch }}
8383
path: sentry-cli-Darwin-${{ matrix.arch }}
8484
if-no-files-found: 'error'
8585

@@ -91,18 +91,75 @@ jobs:
9191
steps:
9292
- uses: actions/download-artifact@v4
9393
with:
94-
pattern: artifact-bin-macos-*
94+
pattern: unsigned-bin-macos-*
9595
merge-multiple: true
9696

9797
- name: Link universal binary
9898
run: lipo -create -output sentry-cli-Darwin-universal sentry-cli-Darwin-x86_64 sentry-cli-Darwin-arm64
9999

100100
- uses: actions/upload-artifact@v4
101101
with:
102-
name: artifact-bin-macos-universal
102+
name: unsigned-bin-macos-universal
103103
path: sentry-cli-Darwin-universal
104104
if-no-files-found: 'error'
105105

106+
sign-macos-binaries:
107+
strategy:
108+
matrix:
109+
include:
110+
- arch: universal
111+
- arch: x86_64
112+
- arch: arm64
113+
114+
needs: [macos, macos_universal]
115+
name: Sign & Notarize macOS Binary (${{ matrix.arch }})
116+
runs-on: ubuntu-24.04
117+
118+
env:
119+
APPLE_CERT_PATH: /tmp/certs.p12
120+
APPLE_API_KEY_PATH: /tmp/apple_key.json
121+
122+
steps:
123+
- name: Decode Apple signing certificate and API key
124+
env:
125+
APPLE_CERT_DATA: ${{ secrets.APPLE_CERT_DATA }}
126+
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
127+
run: |
128+
echo $APPLE_CERT_DATA | base64 --decode > ${{ env.APPLE_CERT_PATH }}
129+
echo $APPLE_API_KEY | base64 --decode > ${{ env.APPLE_API_KEY_PATH }}
130+
131+
- name: Download unsigned binary
132+
uses: actions/download-artifact@v4
133+
with:
134+
name: unsigned-bin-macos-${{ matrix.arch }}
135+
path: sentry-cli-Darwin-${{ matrix.arch }}
136+
137+
- name: Sign binary
138+
uses: indygreg/apple-code-sign-action@v1
139+
with:
140+
input_path: sentry-cli-Darwin-${{ matrix.arch }}
141+
p12_file: ${{ env.APPLE_CERT_PATH }}
142+
p12_password: ${{ secrets.APPLE_CERT_PASSWORD }}
143+
144+
- name: Zip signed binary
145+
run: |
146+
zip sentry-cli-Darwin-${{ matrix.arch }}.zip sentry-cli-Darwin-${{ matrix.arch }}
147+
148+
- name: Notarize binary
149+
uses: indygreg/apple-code-sign-action@v1
150+
with:
151+
input_path: sentry-cli-Darwin-${{ matrix.arch }}.zip
152+
sign: false
153+
notarize: true
154+
app_store_connect_api_key_json_file: ${{ env.APPLE_API_KEY_PATH }}
155+
156+
- name: Upload signed binary
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: artifact-bin-macos-${{ matrix.arch }}
160+
path: sentry-cli-Darwin-${{ matrix.arch }}.zip
161+
if-no-files-found: 'error'
162+
106163
windows:
107164
strategy:
108165
fail-fast: false

0 commit comments

Comments
 (0)