Skip to content

Commit

Permalink
Update macOS notarization for use with notarytool (#1831)
Browse files Browse the repository at this point in the history
  • Loading branch information
m3nu authored Oct 24, 2023
1 parent 071dd86 commit 8d0870e
Showing 1 changed file with 8 additions and 32 deletions.
40 changes: 8 additions & 32 deletions package/macos-package-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ APP_BUNDLE_ID="com.borgbase.client.macos"
APP_BUNDLE="Vorta"
# CERTIFICATE_NAME="Developer ID Application: Joe Doe (XXXXXX)"
# APPLE_ID_USER="[email protected]"
# APPLE_ID_PASSWORD="@keychain:Notarization"
# APPLE_ID_PASSWORD="CHANGEME"
# APPLE_TEAM_ID="CNMSCAXT48"


# Sign app bundle, Sparkle and Borg
Expand Down Expand Up @@ -37,38 +38,13 @@ create-dmg \
"Vorta.dmg" \
"Vorta.app"


# Notarize DMG
RESULT=$(xcrun altool --notarize-app --type osx \
--primary-bundle-id $APP_BUNDLE_ID \
--username $APPLE_ID_USER --password $APPLE_ID_PASSWORD \
--file "$APP_BUNDLE.dmg" --output-format xml)

REQUEST_UUID=$(echo "$RESULT" | xpath5.18 "//key[normalize-space(text()) = 'RequestUUID']/following-sibling::string[1]/text()" 2> /dev/null)

# Poll for notarization status
echo "Submitted notarization request $REQUEST_UUID, waiting for response..."
sleep 60
while true
do
RESULT=$(xcrun altool --notarization-info "$REQUEST_UUID" \
--username "$APPLE_ID_USER" \
--password "$APPLE_ID_PASSWORD" \
--output-format xml)
STATUS=$(echo "$RESULT" | xpath5.18 "//key[normalize-space(text()) = 'Status']/following-sibling::string[1]/text()" 2> /dev/null)

if [ "$STATUS" = "success" ]; then
echo "Notarization of $APP_BUNDLE succeeded!"
break
elif [ "$STATUS" = "in progress" ]; then
echo "Notarization in progress..."
sleep 20
else
echo "Notarization of $APP_BUNDLE failed:"
echo "$RESULT"
exit 1
fi
done
xcrun notarytool submit \
--output-format plist --wait --timeout 10m \
--apple-id $APPLE_ID_USER \
--password $APPLE_ID_PASSWORD \
--team-id $APPLE_TEAM_ID \
"$APP_BUNDLE.dmg"

# Staple the notary ticket
xcrun stapler staple $APP_BUNDLE.dmg
Expand Down

0 comments on commit 8d0870e

Please sign in to comment.