@@ -56,6 +56,38 @@ if [ -n "$ICO" ]; then
5656 iconutil -c icns icon.iconset -o FastPack.app/Contents/Resources/AppIcon.icns
5757fi
5858
59+ # Import Developer ID certificate into a temporary keychain
60+ if [ -n " ${APPLE_CERT_P12:- } " ]; then
61+ KEYCHAIN_PATH=" $RUNNER_TEMP /signing.keychain-db"
62+ KEYCHAIN_PASS=$( openssl rand -hex 16)
63+
64+ security create-keychain -p " $KEYCHAIN_PASS " " $KEYCHAIN_PATH "
65+ security set-keychain-settings -lut 21600 " $KEYCHAIN_PATH "
66+ security unlock-keychain -p " $KEYCHAIN_PASS " " $KEYCHAIN_PATH "
67+
68+ echo " $APPLE_CERT_P12 " | base64 --decode -o " $RUNNER_TEMP /cert.p12"
69+ security import " $RUNNER_TEMP /cert.p12" \
70+ -k " $KEYCHAIN_PATH " \
71+ -P " $APPLE_CERT_PASSWORD " \
72+ -T /usr/bin/codesign
73+ security set-key-partition-list \
74+ -S apple-tool:,apple: \
75+ -s -k " $KEYCHAIN_PASS " " $KEYCHAIN_PATH "
76+ security list-keychains -d user -s " $KEYCHAIN_PATH " login.keychain
77+
78+ codesign --force --options runtime \
79+ --sign " Developer ID Application: $APPLE_TEAM_ID " \
80+ --entitlements /dev/stdin \
81+ FastPack.app << 'ENTITLEMENTS '
82+ <?xml version="1.0" encoding="UTF-8"?>
83+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
84+ "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
85+ <plist version="1.0"><dict>
86+ <key>com.apple.security.cs.allow-unsigned-executable-memory</key><false/>
87+ </dict></plist>
88+ ENTITLEMENTS
89+ fi
90+
5991# Convert DMG background SVG to PNG
6092BG=$( find assets -name ' dmg-background.svg' -print -quit)
6193if [ -n " $BG " ]; then
@@ -85,4 +117,16 @@ CONFIG
85117
86118appdmg appdmg_config.json " $ARTIFACT "
87119
88- rm -rf FastPack.app dmg-bg appdmg_config.json
120+ if [ -n " ${APPLE_CERT_P12:- } " ]; then
121+ codesign --force --sign " Developer ID Application: $APPLE_TEAM_ID " " $ARTIFACT "
122+
123+ xcrun notarytool submit " $ARTIFACT " \
124+ --apple-id " $APPLE_ID " \
125+ --password " $APPLE_APP_PASSWORD " \
126+ --team-id " $APPLE_TEAM_ID " \
127+ --wait
128+
129+ xcrun stapler staple " $ARTIFACT "
130+ fi
131+
132+ rm -rf FastPack.app dmg-bg appdmg_config.json
0 commit comments