Skip to content

Commit 5c358fe

Browse files
revmischaclaude
andcommitted
Add code signing and notarization for macOS releases
Signs the app bundle and .pkg installer with Developer ID certificates, then notarizes both with Apple's notary service for Gatekeeper approval. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0231108 commit 5c358fe

File tree

2 files changed

+70
-2
lines changed

2 files changed

+70
-2
lines changed

.github/workflows/release-macos.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,79 @@ jobs:
118118
-DENABLE_INSTALL_BDEPS=ON
119119
cmake --build cmake-build-frontend-sdl2 --parallel
120120
121+
- name: Import Code Signing Certificates
122+
env:
123+
MACOS_CERTIFICATE_APPLICATION: ${{ secrets.MACOS_CERTIFICATE_APPLICATION }}
124+
MACOS_CERTIFICATE_INSTALLER: ${{ secrets.MACOS_CERTIFICATE_INSTALLER }}
125+
MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
126+
run: |
127+
echo "$MACOS_CERTIFICATE_APPLICATION" | base64 --decode > app_cert.p12
128+
echo "$MACOS_CERTIFICATE_INSTALLER" | base64 --decode > installer_cert.p12
129+
130+
KEYCHAIN_PASSWORD=$(openssl rand -base64 32)
131+
security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
132+
security default-keychain -s build.keychain
133+
security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
134+
135+
security import app_cert.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
136+
security import installer_cert.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/productsign
137+
138+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain
139+
140+
rm app_cert.p12 installer_cert.p12
141+
142+
- name: Sign Application Bundle
143+
run: |
144+
APP_PATH="cmake-build-frontend-sdl2/projectM.app"
145+
IDENTITY="Developer ID Application: Mischa Spiegelmock (5926VBQM6Y)"
146+
147+
find "$APP_PATH/Contents/PlugIns" -name "*.dylib" -exec \
148+
codesign --force --options runtime --sign "$IDENTITY" {} \;
149+
150+
codesign --force --options runtime --sign "$IDENTITY" \
151+
"$APP_PATH/Contents/MacOS/projectMSDL"
152+
153+
codesign --force --options runtime --sign "$IDENTITY" "$APP_PATH"
154+
155+
codesign --verify --deep --strict "$APP_PATH"
156+
157+
- name: Notarize Application
158+
env:
159+
APPLE_ID: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }}
160+
APPLE_PASSWORD: ${{ secrets.MACOS_NOTARIZATION_PASSWORD }}
161+
run: |
162+
xcrun notarytool store-credentials "notary-profile" \
163+
--apple-id "$APPLE_ID" \
164+
--password "$APPLE_PASSWORD" \
165+
--team-id "5926VBQM6Y"
166+
167+
ditto -c -k --keepParent \
168+
"cmake-build-frontend-sdl2/projectM.app" \
169+
"projectM-notarize.zip"
170+
171+
xcrun notarytool submit "projectM-notarize.zip" \
172+
--keychain-profile "notary-profile" \
173+
--wait
174+
175+
xcrun stapler staple "cmake-build-frontend-sdl2/projectM.app"
176+
121177
- name: Package projectMSDL
178+
env:
179+
CODESIGN_IDENTITY_INSTALLER: "Developer ID Installer: Mischa Spiegelmock (5926VBQM6Y)"
122180
run: |
123181
cd cmake-build-frontend-sdl2
124182
cpack -G productbuild
125183
184+
- name: Notarize Package
185+
run: |
186+
PKG_FILE=$(ls cmake-build-frontend-sdl2/*.pkg | head -1)
187+
188+
xcrun notarytool submit "$PKG_FILE" \
189+
--keychain-profile "notary-profile" \
190+
--wait
191+
192+
xcrun stapler staple "$PKG_FILE"
193+
126194
- name: Upload Artifact
127195
uses: actions/upload-artifact@v4
128196
with:

packaging-macos.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/src/resources/gpl-3
1010
set(CPACK_STRIP_FILES TRUE)
1111

1212
### Productbuild configuration
13-
set(CPACK_PKGBUILD_IDENTITY_NAME "${CODESIGN_IDENTITY_INSTALLER}")
14-
set(CPACK_PRODUCTBUILD_IDENTITY_NAME "${CODESIGN_IDENTITY_INSTALLER}")
13+
set(CPACK_PKGBUILD_IDENTITY_NAME "$ENV{CODESIGN_IDENTITY_INSTALLER}")
14+
set(CPACK_PRODUCTBUILD_IDENTITY_NAME "$ENV{CODESIGN_IDENTITY_INSTALLER}")
1515
set(CPACK_PRODUCTBUILD_IDENTIFIER "org.projectm-visualizer.projectmsdl")
1616

1717
string(REPLACE ";" "," INSTALL_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")

0 commit comments

Comments
 (0)