annotate deploy/osx/notarize.sh @ 388:0a45b9debc30

Make sure zipfile is available
author Chris Cannam
date Mon, 08 Jun 2020 16:35:31 +0100
parents 78af557445b2
children
rev   line source
Chris@380 1 #!/bin/bash
Chris@380 2
Chris@380 3 ## The following assumes we have generated an app password at
Chris@380 4 ## appleid.apple.com and then stored it to keychain id "altool" using
Chris@380 5 ## e.g.
Chris@380 6 ## security add-generic-password -a "cannam+apple@all-day-breakfast.com" \
Chris@380 7 ## -w "generated-app-password" -s "altool"
Chris@380 8
Chris@380 9 user="cannam+apple@all-day-breakfast.com"
Chris@380 10 bundleid="org.sonicvisualiser.SonicAnnotator"
Chris@380 11
Chris@380 12 set -e
Chris@380 13
Chris@380 14 exe="$1"
Chris@380 15
Chris@380 16 if [ ! -f "$exe" ] || [ -n "$2" ]; then
Chris@380 17 echo "Usage: $0 <executable>"
Chris@380 18 echo " e.g. $0 my-program"
Chris@380 19 exit 2
Chris@380 20 fi
Chris@380 21
Chris@380 22 set -u
Chris@380 23
Chris@380 24 echo
Chris@380 25 echo "Uploading for notarization..."
Chris@380 26
Chris@380 27 uuidfile=.notarization-uuid
Chris@380 28 statfile=.notarization-status
Chris@380 29 rm -f "$uuidfile" "$statfile"
Chris@380 30
Chris@380 31 rm -f bundle.zip
Chris@382 32 rm -rf bundle
Chris@382 33 mkdir bundle
Chris@382 34 cp "$exe" bundle/
Chris@382 35 ditto -c -k bundle bundle.zip
Chris@380 36
Chris@380 37 xcrun altool --notarize-app \
Chris@381 38 -f "bundle.zip" \
Chris@380 39 --primary-bundle-id "$bundleid" \
Chris@380 40 -u "$user" \
Chris@380 41 -p @keychain:altool 2>&1 | tee "$uuidfile"
Chris@380 42
Chris@380 43 uuid=$(cat "$uuidfile" | grep RequestUUID | awk '{ print $3; }')
Chris@380 44
Chris@380 45 if [ -z "$uuid" ]; then
Chris@380 46 echo
Chris@380 47 echo "Failed (no UUID returned, check output)"
Chris@380 48 exit 1
Chris@380 49 fi
Chris@380 50
Chris@380 51 echo "Done, UUID is $uuid"
Chris@380 52
Chris@380 53 echo
Chris@380 54 echo "Waiting and checking for completion..."
Chris@380 55
Chris@380 56 while true ; do
Chris@380 57 sleep 30
Chris@380 58
Chris@380 59 xcrun altool --notarization-info \
Chris@380 60 "$uuid" \
Chris@380 61 -u "$user" \
Chris@380 62 -p @keychain:altool 2>&1 | tee "$statfile"
Chris@380 63
Chris@380 64 if grep -q 'Package Approved' "$statfile"; then
Chris@380 65 echo
Chris@380 66 echo "Approved! Status output is:"
Chris@380 67 cat "$statfile"
Chris@380 68 break
Chris@380 69 elif grep -q 'in progress' "$statfile" ; then
Chris@380 70 echo
Chris@380 71 echo "Still in progress... Status output is:"
Chris@380 72 cat "$statfile"
Chris@380 73 echo "Waiting..."
Chris@380 74 else
Chris@380 75 echo
Chris@380 76 echo "Failure or unknown status in output:"
Chris@380 77 cat "$statfile"
Chris@380 78 exit 2
Chris@380 79 fi
Chris@380 80 done
Chris@380 81
Chris@380 82 echo
Chris@380 83 echo "Done, not stapling as just an executable"
Chris@380 84