Skip to content

Commit

Permalink
appsign: Switch to notarytool
Browse files Browse the repository at this point in the history
altool is deprecated
  • Loading branch information
dhinakg committed Sep 19, 2023
1 parent 1cd1e2b commit 4868d38
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions codesign/appsign.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ notarizefile() { # $1: path to file to notarize, $2: identifier
fi

if [ "$MAC_ACCOUNT_PASSWORD" = "" ]; then
abort "Unable to find Apple account namee" "Set MAC_ACCOUNT_PASSWORD environment variable"
abort "Unable to find Apple account name" "Set MAC_ACCOUNT_PASSWORD environment variable"
fi

asc_provider=$(security find-certificate -a -c "Developer ID" "${workdir}/build.keychain" | grep "alis" | head -1 | cut -d'"' -f4 | cut -d'(' -f2 | cut -d')' -f1)
Expand All @@ -100,33 +100,36 @@ notarizefile() { # $1: path to file to notarize, $2: identifier

# Upload file
echo "Uploading ${filepath} for notarization for ${asc_provider}"
requestUUID=$(xcrun altool --notarize-app \
--primary-bundle-id "$identifier" \
--username "${MAC_ACCOUNT_NAME}" \
--password "@env:MAC_ACCOUNT_PASSWORD" \
--asc-provider "${asc_provider}" \
--file "$filepath" 2>&1 \
| awk '/RequestUUID/ { print $NF; }')

output=$(xcrun notarytool submit \
"$filepath" \
--apple-id "${MAC_ACCOUNT_NAME}" \
--password "@env:MAC_ACCOUNT_PASSWORD" \
--team-id "${asc_provider}" \
--wait 2>&1)
requestUUID=$(echo "$output" | awk '/RequestUUID/ { print $NF; }')

echo "Output: $output"
echo "Notarization RequestUUID: $requestUUID"

if [ "$requestUUID" = "" ]; then
abort "Could not upload for notarization"
fi

# Wait for status to be not "in progress" any more
request_status="in progress"
while [ "$request_status" = "in progress" ]; do
printf "waiting... "
sleep 10
request_status=$(requeststatus "$requestUUID")
echo "$request_status"
done
# request_status="in progress"
# while [ "$request_status" = "in progress" ]; do
# printf "waiting... "
# sleep 10
# request_status=$(requeststatus "$requestUUID")
# echo "$request_status"
# done

# Print status information
xcrun altool --notarization-info "$requestUUID" \
--username "${MAC_ACCOUNT_NAME}" \
--password "@env:MAC_ACCOUNT_PASSWORD"
xcrun notarytool info \
"$requestUUID" \
--username "${MAC_ACCOUNT_NAME}" \
--password "@env:MAC_ACCOUNT_PASSWORD" \
--team-id "${asc_provider}"
echo

if [ "$request_status" != "success" ]; then
Expand Down

0 comments on commit 4868d38

Please sign in to comment.