Skip to content

Commit

Permalink
Use notarytool
Browse files Browse the repository at this point in the history
  • Loading branch information
Zensey committed Nov 21, 2023
1 parent 55c0990 commit cb52941
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ jobs:
- name: Notarize
env:
PRIMARY_BUNDLE_ID: com.mysterium.launcher
APPLE_TEAM_ID: KPKW2HX458
APPLE_ID: ${{ secrets.NOTARIZE_EMAIL }}
TARGET_BINARY: ./mysterium_launcher_macos.dmg
APP_SPECIFIC_PASSWORD: ${{ secrets.NOTARIZE_APP_SPEC_PWD }}
Expand Down
51 changes: 34 additions & 17 deletions notarize.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
#!/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 \
--team-id "${APPLE_TEAM_ID}" \
--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}

0 comments on commit cb52941

Please sign in to comment.