Skip to content

Commit

Permalink
Use notarytool instead of altool for notarization, as altool has been…
Browse files Browse the repository at this point in the history
… deprecated.
  • Loading branch information
akshay-joshi committed Nov 1, 2023
1 parent d3dd5c0 commit e7d9265
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 52 deletions.
73 changes: 23 additions & 50 deletions pkg/mac/build-functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -432,59 +432,32 @@ _notarize_pkg() {
return
fi
# Notarize the package. Try three times, to allow for upload issues
for i in {1..3}; do
echo "Uploading DMG for notarisation (attempt ${i} of 3)..."
STATUS=$(xcrun altool --notarize-app \
-f "${DMG_NAME}" \
--asc-provider "${DEVELOPER_NAME}" \
--primary-bundle-id org.pgadmin.pgadmin4 \
-u "${DEVELOPER_USER}" \
-p "${DEVELOPER_ASP}" 2>&1)
RETVAL=$?
if [ ${RETVAL} != 0 ]; then
echo "Attempt ${i} failure: ${STATUS}"
else
# Success!
break;
fi
done
# print error if above command fails
if [ ${RETVAL} != 0 ]; then
echo "Notarization failed."
exit 1
fi
# Get the request ID
REQUEST_UUID=$(echo "${STATUS}" | awk '/RequestUUID/ { print $NF; }')
echo "Notarization request ID: ${REQUEST_UUID}"
# Now we need to wait for the results. Try 60 times.
for i in {1..60}; do
echo "Waiting 30 seconds..."
sleep 30
echo "Requesting notarisation result (attempt ${i} of 60)..."
REQUEST_STATUS=$(xcrun altool --notarization-info "${REQUEST_UUID}" \
--username "${DEVELOPER_USER}" \
--password "${DEVELOPER_ASP}" 2>&1 | \
awk -F ': ' '/Status:/ { print $2; }' )
if [[ "${REQUEST_STATUS}" == "success" ]]; then
break
fi
done
echo "Uploading DMG for Notarization ..."
STATUS=$(xcrun notarytool submit "${DMG_NAME}" \
--team-id "${DEVELOPER_TEAM_ID}" \
--apple-id "${DEVELOPER_USER}" \
--password "${DEVELOPER_ASP}" 2>&1)
# Get the submission ID
SUBMISSION_ID=$(echo "${STATUS}" | awk -F ': ' '/id:/ { print $2; exit; }')
echo "Notarization submission ID: ${SUBMISSION_ID}"
echo "Waiting for Notarization to be completed ..."
xcrun notarytool wait "${SUBMISSION_ID}" \
--team-id "${DEVELOPER_TEAM_ID}" \
--apple-id "${DEVELOPER_USER}" \
--password "${DEVELOPER_ASP}"
# Print status information
xcrun altool --notarization-info "${REQUEST_UUID}" \
--username "${DEVELOPER_USER}" \
--password "${DEVELOPER_ASP}"
REQUEST_STATUS=$(xcrun notarytool info "${SUBMISSION_ID}" \
--team-id "${DEVELOPER_TEAM_ID}" \
--apple-id "${DEVELOPER_USER}" \
--password "${DEVELOPER_ASP}" 2>&1 | \
awk -F ': ' '/status:/ { print $2; }')
if [[ "${REQUEST_STATUS}" != "success" ]]; then
echo "Notarization failed."
exit 1
if [[ "${REQUEST_STATUS}" != "Accepted" ]]; then
echo "Notarization failed."
exit 1
fi
# Staple the notarization
Expand Down
4 changes: 2 additions & 2 deletions pkg/mac/notarization.conf.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# In order to enable notarization of the Mac Appbundle, copy this file to
# notarization.conf, and edit the values below to reflect your Apple
# Developer User ID, app-specific password and Provider Shortname.
# Developer User ID, app-specific password and Team ID.
#
# You can use the following command to see the available shortnames for your
# Apple Developer ID (substituting the appropriate username/password):
Expand All @@ -9,4 +9,4 @@

[email protected]
DEVELOPER_ASP=1234-abcd-5678-efgh
DEVELOPER_NAME=MyCompany
DEVELOPER_TEAM_ID=MyTeamID

0 comments on commit e7d9265

Please sign in to comment.