Skip to content

Commit 1dddb1f

Browse files
committed
Add support for signing OSX binaries
Note this requires a real mac (for now)
1 parent 7024ac7 commit 1dddb1f

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

build-release.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,33 @@ if [ "${build_classical}" == "1" ]; then
145145
zip -q -9 -r "${reldir}/${binname}.zip" Godot.app
146146
rm -rf Godot.app
147147

148+
if [ ! -z "${OSX_HOST}" ]; then
149+
osx_tmpdir=$(ssh "${OSX_HOST}" "mktemp -d")
150+
151+
scp "${reldir}/${binname}.zip" "${OSX_HOST}:${osx_tmpdir}"
152+
ssh "${OSX_HOST}" "
153+
cd ${osx_tmpdir} && \
154+
unzip ${binname}.zip &&\
155+
codesign --timestamp --options=runtime -s ${OSX_KEY_ID} -v Godot.app/Contents/MacOS/Godot && \
156+
zip -r ${binname}_signed.zip Godot.app"
157+
158+
request_uuid=$(ssh "${OSX_HOST}" "xcrun altool --notarize-app --primary-bundle-id \"${OSX_BUNDLE_ID}\" --username \"${APPLE_ID}\" --password \"${APPLE_ID_PASSWORD}\" --file ${osx_tmpdir}/${binname}_signed.zip")
159+
request_uuid=$(echo ${request_uuid} | sed -e 's/.*RequestUUID = //')
160+
ssh "${OSX_HOST}" "while xcrun altool --notarization-history 0 -u \"${APPLE_ID}\" -p \"${APPLE_ID_PASSWORD}\" | grep -q ${request_uuid}.*in\ progress; do echo Waiting on Apple signature; sleep 30s; done"
161+
if ! ssh "${OSX_HOST}" "xcrun altool --notarization-history 0 -u \"${APPLE_ID}\" -p \"${APPLE_ID_PASSWORD}\" | grep -q ${request_uuid}.*success"; then
162+
echo "Signing failed?"
163+
ssh "${OSX_HOST}" "rm -rf ${osx_tmpdir}"
164+
exit 1
165+
else
166+
ssh "${OSX_HOST}" "
167+
cd ${osx_tmpdir} && \
168+
xcrun stapler staple Godot.app && \
169+
zip -r ${binname}_stapled.zip Godot.app"
170+
scp "${OSX_HOST}:${osx_tmpdir}/${binname}_stapled.zip" ${reldir}/${binname}.zip
171+
ssh "${OSX_HOST}" "rm -rf ${osx_tmpdir}"
172+
fi
173+
fi
174+
148175
# Templates
149176
rm -rf osx_template.app
150177
cp -r git/misc/dist/osx_template.app .

config.sh.in

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,15 @@ export SIGN_PASSWORD=""
2727
# Use your own when making a thirdparty build.
2828
export SIGN_NAME=""
2929
export SIGN_URL=""
30+
31+
# Hostname or IP address of an OSX host (Needed for signing)
32+
33+
export OSX_HOST=""
34+
# ID of the Apple certificate used to sign
35+
export OSX_KEY_ID=""
36+
# Bundle id for the signed app
37+
export OSX_BUNDLE_ID=""
38+
# Username/password for Apple's signing APIs (used for atltool)
39+
export APPLE_ID=""
40+
export APPLE_ID_PASSWORD=""
41+

0 commit comments

Comments
 (0)