Skip to content

Instantly share code, notes, and snippets.

@johngirvin
Last active April 16, 2023 02:33
Show Gist options
  • Save johngirvin/4e0fdc1e3651c3f15fc491810ecd911a to your computer and use it in GitHub Desktop.
Save johngirvin/4e0fdc1e3651c3f15fc491810ecd911a to your computer and use it in GitHub Desktop.
#!/bin/bash
PROJ="/path/to/your/project/"
NAME="MyAwesomeGame"
SVER="1.0.0"
GODOT="/Applications/Godot.app/Contents/MacOS/Godot --path ${PROJ}/src"
###
# Mac OSX (RELEASE)
echo
echo
echo
echo "macos : exporting"
cd ${PROJ}/export/itch/macos-release
rm -rf ${NAME} && mkdir ${NAME} && cd ${NAME}
rm /tmp/${NAME}-notarize-*xml
${GODOT} --quiet --export 'Mac OSX (RELEASE)' `pwd`/${NAME}.dmg
echo "macos : signing"
codesign --force --deep --sign '<certificate name as it appears in keychain access>' --timestamp ${NAME}.dmg
echo "macos : notarizing (upload)"
xcrun altool --notarize-app -t osx -f ${NAME}.dmg --primary-bundle-id com.mycompany.myawesomegame -u '<your apple id>' -p '<applieid password or app specific password for xcrun>' --output-format xml > /tmp/${NAME}-notarize-app.xml
NUUID=`/usr/libexec/PlistBuddy -c 'Print :notarization-upload:RequestUUID' /tmp/${NAME}-notarize-app.xml`
echo " ${NUUID}"
if [ -z "${NUUID}" ]; then
echo "* error: no RequestUUID found in upload response"
cat /tmp/${NAME}-notarize-app.xml
exit 20
fi
echo "macos : notarizing (status)"
while true; do
xcrun altool --notarization-info ${NUUID} -u '<your apple id>' -p '<applieid password or app specific password for xcrun>' --output-format xml > /tmp/${NAME}-notarize-info.xml
NSTAT=`/usr/libexec/PlistBuddy -c 'Print :notarization-info:Status' /tmp/${NAME}-notarize-info.xml`
echo " `date "+%H:%M:%S"` ${NSTAT}"
if [ -z "${NUUID}" ]; then
echo "* error: no Status found in info response"
cat /tmp/${NAME}-notarize-info.xml
exit 20
fi
if [ "${NSTAT}" == "success" ]; then
break
fi
sleep 30s
done
echo "macos : notarizing (staple)"
xcrun stapler staple ${NAME}.dmg
rm /tmp/${NAME}-notarize-*xml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment