Skip to content

Instantly share code, notes, and snippets.

@stevesparks
Last active May 13, 2020 16:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevesparks/714219a5ef2524605762fec3e92fcd3c to your computer and use it in GitHub Desktop.
Save stevesparks/714219a5ef2524605762fec3e92fcd3c to your computer and use it in GitHub Desktop.
Apple Mac notarization script
#!/bin/sh
##
## CHANGE THESE FOR YOUR NEEDS
##
APPLE_USER=your@username.here
APPLE_PASS=apple-app-specific-password
APPNAME="$1"
ZIPNAME="$APPNAME.zip"
echo Creating ZIP file...
ditto -c -k --rsrc --keepParent "$APPNAME" "$ZIPNAME"
echo Submitting app for notarization.
result=`xcrun altool --notarize-app --primary-bundle-id com.peloton.crescendo --username $APPLE_USER --password $APPLE_PASS --file "$ZIPNAME" 2>&1`
uuid=`echo $result | grep RequestUUID | sed -e 's/^No errors uploading.*RequestUUID = \([0-9A-F-]*\)/\1/'`
echo UUID : $uuid
statuscommand="xcrun altool --notarization-info $uuid --username $APPLE_USER --password $APPLE_PASS"
echo Status command is:
echo " $statuscommand"
result="in progress"
logurl=""
while [ "$result" = "in progress" ]; do
echo Sleeping for 60 before checking.
sleep 60
statusoutput=`$statuscommand`
result=`echo $statusoutput | grep Status | sed -e 's/.*Status: \(.*\)/\1/'`
logurl=`echo $statusoutput | grep LogFileURL | sed -e 's/.*LogFileURL: \(.*\)/\1/'`
done
echo Final status: $result
echo ""
echo Notarization log file URL: $logurl
# do something here -- look for warnings
#logcontents=`curl -s $logurl`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment