@@ -117,14 +117,121 @@ jobs:
117117 '-DDEFAULT_TEXTURES_PATH=${application.dir}/../share/projectMSDL/textures/' \
118118 -DENABLE_INSTALL_BDEPS=ON
119119 cmake --build cmake-build-frontend-sdl2 --parallel
120+ cmake --install cmake-build-frontend-sdl2 --prefix "${{ github.workspace }}/install"
121+
122+ - name : Import Code Signing Certificates
123+ env :
124+ MACOS_CERTIFICATE_APPLICATION : ${{ secrets.MACOS_CERTIFICATE_APPLICATION }}
125+ MACOS_CERTIFICATE_INSTALLER : ${{ secrets.MACOS_CERTIFICATE_INSTALLER }}
126+ MACOS_CERTIFICATE_PASSWORD : ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
127+ run : |
128+ echo "$MACOS_CERTIFICATE_APPLICATION" | base64 --decode > app_cert.p12 && chmod 600 app_cert.p12
129+ echo "$MACOS_CERTIFICATE_INSTALLER" | base64 --decode > installer_cert.p12 && chmod 600 installer_cert.p12
130+
131+ KEYCHAIN_PASSWORD=$(openssl rand -base64 32)
132+ security create-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
133+ security default-keychain -s build.keychain
134+ security unlock-keychain -p "$KEYCHAIN_PASSWORD" build.keychain
135+
136+ security import app_cert.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
137+ security import installer_cert.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/productsign
138+
139+ security set-key-partition-list -S apple-tool:,apple:,codesign:,productbuild: -s -k "$KEYCHAIN_PASSWORD" build.keychain
140+
141+ rm app_cert.p12 installer_cert.p12
142+
143+ - name : Sign Application Bundle
144+ run : |
145+ APP_PATH="${{ github.workspace }}/install/projectM.app"
146+ IDENTITY="Developer ID Application: Mischa Spiegelmock (5926VBQM6Y)"
147+
148+ # Sign all dylibs first (if PlugIns directory exists)
149+ if [ -d "$APP_PATH/Contents/PlugIns" ]; then
150+ find "$APP_PATH/Contents/PlugIns" -name "*.dylib" -exec \
151+ codesign --force --options runtime --sign "$IDENTITY" {} \;
152+ fi
153+
154+ # Sign the main executable
155+ codesign --force --options runtime --sign "$IDENTITY" \
156+ "$APP_PATH/Contents/MacOS/projectM"
157+
158+ # Sign the entire bundle
159+ codesign --force --options runtime --sign "$IDENTITY" "$APP_PATH"
160+
161+ # Verify
162+ codesign --verify --deep --strict "$APP_PATH"
163+
164+ - name : Notarize Application
165+ env :
166+ API_KEY_BASE64 : ${{ secrets.MACOS_NOTARY_API_KEY }}
167+ API_KEY_ID : ${{ secrets.MACOS_NOTARY_KEY_ID }}
168+ API_ISSUER_ID : ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
169+ run : |
170+ mkdir -p ~/.private_keys
171+ echo "$API_KEY_BASE64" | base64 --decode > ~/.private_keys/AuthKey_${API_KEY_ID}.p8
172+ chmod 600 ~/.private_keys/AuthKey_${API_KEY_ID}.p8
173+
174+ ditto -c -k --keepParent \
175+ "${{ github.workspace }}/install/projectM.app" \
176+ "projectM-notarize.zip"
177+
178+ xcrun notarytool submit "projectM-notarize.zip" \
179+ --key ~/.private_keys/AuthKey_${API_KEY_ID}.p8 \
180+ --key-id "$API_KEY_ID" \
181+ --issuer "$API_ISSUER_ID" \
182+ --wait
183+
184+ xcrun stapler staple "${{ github.workspace }}/install/projectM.app"
120185
121186 - name : Package projectMSDL
122187 run : |
123- cd cmake-build-frontend-sdl2
124- cpack -G productbuild
188+ # Get version from CMake
189+ VERSION=$(grep "project(projectMSDL" frontend-sdl2/CMakeLists.txt | sed -E 's/.*VERSION ([0-9.]+).*/\1/')
190+
191+ # Build component package from signed app
192+ pkgbuild \
193+ --root "${{ github.workspace }}/install" \
194+ --identifier "org.projectm-visualizer.projectmsdl" \
195+ --version "$VERSION" \
196+ --install-location "/Applications" \
197+ --component-plist "frontend-sdl2/src/resources/projectMSDL-component.plist" \
198+ "projectMSDL-component.pkg"
199+
200+ # Build unsigned product archive
201+ productbuild \
202+ --distribution "frontend-sdl2/src/resources/distribution.xml" \
203+ --package-path "." \
204+ --resources "frontend-sdl2/src/resources" \
205+ "projectM-${VERSION}-macOS-universal-unsigned.pkg"
206+
207+ # Sign the package with productsign
208+ productsign \
209+ --sign "Developer ID Installer: Mischa Spiegelmock (5926VBQM6Y)" \
210+ "projectM-${VERSION}-macOS-universal-unsigned.pkg" \
211+ "projectM-${VERSION}-macOS-universal.pkg"
212+
213+ rm "projectM-${VERSION}-macOS-universal-unsigned.pkg"
214+
215+ - name : Notarize Package
216+ env :
217+ API_KEY_ID : ${{ secrets.MACOS_NOTARY_KEY_ID }}
218+ API_ISSUER_ID : ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
219+ run : |
220+ PKG_FILE=$(ls projectM-*.pkg | head -1)
221+
222+ xcrun notarytool submit "$PKG_FILE" \
223+ --key ~/.private_keys/AuthKey_${API_KEY_ID}.p8 \
224+ --key-id "$API_KEY_ID" \
225+ --issuer "$API_ISSUER_ID" \
226+ --wait
227+
228+ xcrun stapler staple "$PKG_FILE"
229+
230+ # Clean up API key
231+ rm -f ~/.private_keys/AuthKey_${API_KEY_ID}.p8
125232
126233 - name : Upload Artifact
127234 uses : actions/upload-artifact@v4
128235 with :
129236 name : projectMSDL-macOS-Universal
130- path : cmake-build-frontend-sdl2/ *.pkg
237+ path : projectM- *.pkg
0 commit comments