From b6793bbc938464608d1113c7a4bd18cd5bd848fe Mon Sep 17 00:00:00 2001 From: Anton Litvinov Date: Tue, 21 Nov 2023 16:03:22 +0300 Subject: [PATCH] Use notarytool --- notarize.sh | 50 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/notarize.sh b/notarize.sh index 95321bb..4ed422f 100755 --- a/notarize.sh +++ b/notarize.sh @@ -1,24 +1,40 @@ #!/bin/sh -# Submit the dmg and get REQUEST_UUID -SUBMISSION_INFO=$(xcrun altool --notarize-app --primary-bundle-id=${PRIMARY_BUNDLE_ID} -u ${APPLE_ID} -p ${APP_SPECIFIC_PASSWORD} --file ${TARGET_BINARY} 2>&1) ; +## Submit the dmg and get REQUEST_UUID +#SUBMISSION_INFO=$(xcrun altool --notarize-app --primary-bundle-id=${PRIMARY_BUNDLE_ID} -u ${APPLE_ID} -p ${APP_SPECIFIC_PASSWORD} --file ${TARGET_BINARY} 2>&1) ; +# +#if [ $? != 0 ]; then +# printf "Submission failed: $SUBMISSION_INFO \n" +# exit 5 +#fi +# +#REQUEST_UUID=$(echo ${SUBMISSION_INFO} | awk -F ' = ' '/RequestUUID/ {print $2}') +#if [ -z "${REQUEST_UUID}" ]; then +# echo "Errors trying to upload ${TARGET_BINARY}.zip: ${SUBMISSION_INFO}" +# exit 6 +#fi +# +## Wait for "Package Approved" +#while ! xcrun altool --notarization-info ${REQUEST_UUID} --username ${APPLE_ID} --password ${APP_SPECIFIC_PASSWORD} --output-format xml | grep -q 'Package Approved' ; do +# sleep 60; +#done +# +#echo "Package Approved: REQUEST_UUID=$REQUEST_UUID can be accessed with this query: xcrun altool --notarization-info $REQUEST_UUID --username ${APPLE_ID} --output-format xml --password app_specific_password" +#xcrun stapler staple ${TARGET_BINARY} -if [ $? != 0 ]; then - printf "Submission failed: $SUBMISSION_INFO \n" - exit 5 -fi - -REQUEST_UUID=$(echo ${SUBMISSION_INFO} | awk -F ' = ' '/RequestUUID/ {print $2}') -if [ -z "${REQUEST_UUID}" ]; then - echo "Errors trying to upload ${TARGET_BINARY}.zip: ${SUBMISSION_INFO}" - exit 6 -fi +echo "notarytool submit" -# Wait for "Package Approved" -while ! xcrun altool --notarization-info ${REQUEST_UUID} --username ${APPLE_ID} --password ${APP_SPECIFIC_PASSWORD} --output-format xml | grep -q 'Package Approved' ; do - sleep 60; -done +xcrun notarytool submit \ + --apple-id ${APPLE_ID} \ + --password ${APP_SPECIFIC_PASSWORD} \ + --wait \ + ${TARGET_BINARY} -echo "Package Approved: REQUEST_UUID=$REQUEST_UUID can be accessed with this query: xcrun altool --notarization-info $REQUEST_UUID --username ${APPLE_ID} --output-format xml --password app_specific_password" +if [ $? -eq 0 ]; then + echo "Notarization submitted successfully." +else + echo "Notarization failed." + exit 1 +fi xcrun stapler staple ${TARGET_BINARY}