From a909602efc80f005102a0e30da5f348078c58dd6 Mon Sep 17 00:00:00 2001
From: Kateryna Kostiuk <kateryna.kostiuk@savoirfairelinux.com>
Date: Fri, 29 Jul 2022 14:57:36 -0400
Subject: [PATCH] macOS: use notarytool for notarization

Change-Id: I8d5446234c070a3877301d2903b98c54db22ab90
---
 notarize.sh | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)

diff --git a/notarize.sh b/notarize.sh
index f282f5a..e46564a 100755
--- a/notarize.sh
+++ b/notarize.sh
@@ -1,22 +1,9 @@
 #!/bin/bash
 
 cd build-local
-/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework/Versions/A/Support/altool --notarize-app -t osx -f ${LIBRARYNAME}.zip --primary-bundle-id ${BUNDLE_ID} -u ${APPLE_ACCOUNT} -p ${APPLE_PASSWORD} --output-format xml -itc_provider ${TEAM_ID} > UploadInfo.plist
-REQUESTID=$(xmllint --xpath "/plist/dict[key='notarization-upload']/dict/key[.='RequestUUID']/following-sibling::string[1]/node()" UploadInfo.plist)
-echo "file uploaded for notarization"
-echo ${REQUESTID}
-sleep 60
-x=1
-while [ $x -le 15 ];
-do
-/Applications/Xcode.app/Contents/SharedFrameworks/ContentDeliveryServices.framework/Versions/A/Frameworks/AppStoreService.framework/Versions/A/Support/altool --notarization-info ${REQUESTID} -u ${APPLE_ACCOUNT}  -p ${APPLE_PASSWORD}  --output-format xml > RequestedInfo.plist
-ANSWER=$(xmllint --xpath "/plist/dict[key='notarization-info']/dict/key[.='Status']/following-sibling::string[1]/node()" RequestedInfo.plist)
-if [ "$ANSWER" == "in progress" ];
-then
-echo  "notarization in progress"
-sleep 60
-x=$(( $x + 1 ))
-elif [ "$ANSWER" == "success" ]
+xcrun notarytool submit ${LIBRARYNAME}.zip --apple-id ${APPLE_ACCOUNT} --password ${APPLE_PASSWORD} --output-format plist --team-id ${TEAM_ID} --wait > UploadInfo.plist
+STATUS=$(xmllint --xpath "/plist/dict/key[.='status']/following-sibling::string[1]/node()" UploadInfo.plist)
+if [ "$STATUS" == "Accepted" ];
 then
 echo  "notarization success"
 break
@@ -24,11 +11,4 @@ else
 echo "notarization failed"
 break
 exit 1
-fi
-done
-ANSWER=$(xmllint --xpath "/plist/dict[key='notarization-info']/dict/key[.='Status']/following-sibling::string[1]/node()" RequestedInfo.plist)
-if [ "$ANSWER" != "success" ];
-then
-echo "notarization failed"
-exit 1
-fi
+fi
\ No newline at end of file
-- 
GitLab