Skip to content

Commit 3b66056

Browse files
committed
Integrating notarization bash scripting, to wait until status detected
1 parent b0be2b4 commit 3b66056

File tree

1 file changed

+40
-11
lines changed

1 file changed

+40
-11
lines changed

installer/build-mac-dmg.sh

+40-11
Original file line numberDiff line numberDiff line change
@@ -62,31 +62,60 @@ codesign -s "OpenShot Studios, LLC" --force --deep --options runtime --timestamp
6262
echo "Verifying App Signing"
6363
spctl -a -vv "build/$OS_APP_NAME"
6464

65-
echo "Building Custom DMG"
66-
appdmg "installer/dmg-template.json" "build/$OS_DMG_NAME"
67-
68-
echo "Code Sign DMG"
69-
codesign -s "OpenShot Studios, LLC" --force --timestamp=http://timestamp.apple.com/ts01 "build/$OS_DMG_NAME"
70-
7165
echo "Create Zip of .App for Notarization"
7266
ditto -c -k --keepParent "build/$OS_APP_NAME" "build/$OS_APP_ZIP"
7367

7468
echo "Notarize Zip file (send to apple)"
7569
# No errors uploading '/Users/jonathan/builds/7d5103a1/0/OpenShot/openshot-qt/build/test.zip'.
7670
# RequestUUID = cc285719-823f-4f0b-8e71-2df4bbbdaf72
77-
xcrun altool --notarize-app --primary-bundle-id "org.openshot.openshot-qt.zip" --username "[email protected]" --password "@keychain:NOTARIZE_AUTH" --file "build/$OS_APP_ZIP"
71+
notarize_output=$(xcrun altool --notarize-app --primary-bundle-id "org.openshot.openshot-qt.zip" --username "[email protected]" --password "@keychain:NOTARIZE_AUTH" --file "build/$OS_APP_ZIP")
72+
echo "$notarize_output"
73+
74+
echo "Parse Notarize Output and get Notarization RequestUUID"
75+
pat='RequestUUID\s=\s(.*)\\'
76+
[[ "$notarize_output" =~ $pat ]]
77+
REQUEST_UUID="${BASH_REMATCH[0]}"
78+
echo " RequestUUID Found: $REQUEST_UUID"
7879

79-
echo "Check Notarization Progress..."
80-
#xcrun altool --notarization-history 0 -u "[email protected]" -p "@keychain:NOTARIZE_AUTH"
80+
echo "Check Notarization Progress... (list recent notarization records)"
81+
xcrun altool --notarization-history 0 -u "[email protected]" -p "@keychain:NOTARIZE_AUTH"
8182

82-
echo "Check Notarization Info"
83+
echo "Check Notarization Info (loop until status detected)"
8384
# No errors getting notarization info.
8485
#
8586
# Date: 2020-07-05 21:22:35 +0000
8687
# Hash: ef939ddefec14d7f0b7fe467c5761cdccab3414425a33c066a5629dd71eff626
8788
# RequestUUID: cc285719-823f-4f0b-8e71-2df4bbbdaf72
8889
# Status: in progress
89-
#xcrun altool --notarization-info ****ID**** -u "[email protected]" -p "@keychain:NOTARIZE_AUTH"
90+
START=`date +%s`
91+
while [ $(( $(date +%s) - 3600 )) -lt $START ]; do
92+
notarize_info=$(xcrun altool --notarization-info "$REQUEST_UUID" -u "[email protected]" -p "@keychain:NOTARIZE_AUTH")
93+
echo "$notarize_info"
94+
95+
pat='Status:\s(.*)'
96+
[[ "$notarize_info" =~ $pat ]]
97+
notarize_status="${BASH_REMATCH[1]}"
98+
99+
if [ "$notarize_status" != "in progress" ]; then
100+
echo "Notarization Status Found: $notarize_status"
101+
break
102+
fi
103+
104+
# Wait 30 seconds
105+
sleep 10
106+
done
107+
108+
echo "Staple Notarization Ticket to App"
109+
xcrun stapler staple "build/$OS_APP_NAME"
110+
111+
echo "Building Custom DMG"
112+
appdmg "installer/dmg-template.json" "build/$OS_DMG_NAME"
113+
114+
echo "Code Sign DMG"
115+
codesign -s "OpenShot Studios, LLC" --force --timestamp=http://timestamp.apple.com/ts01 "build/$OS_DMG_NAME"
116+
117+
echo "Staple Notarization Ticket to DMG"
118+
xcrun stapler staple "build/$OS_DMG_NAME"
90119

91120
echo "Verifying DMG Signing"
92121
spctl -a -t open --context context:primary-signature -v "build/$OS_DMG_NAME"

0 commit comments

Comments
 (0)