Skip to content

Commit

Permalink
ci: replace altool with notarytool
Browse files Browse the repository at this point in the history
Apple will break altool notarization on Nov 2023, so we are forced to update our ci
  • Loading branch information
lwouis committed Jun 23, 2023
1 parent 8152c3c commit 7d823dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
2 changes: 2 additions & 0 deletions alt-tab-macos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@
BF0C816D6B12CC13F741E61F /* hi */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = hi; path = Localizable.strings; sourceTree = "<group>"; };
BF0C816F38751995E4F49BB0 /* he */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = he; path = InfoPlist.strings; sourceTree = "<group>"; };
BF0C817E063D1405392D6C5B /* he */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = he; path = Localizable.strings; sourceTree = "<group>"; };
BF0C81D602ED642A48D50B78 /* notarytool */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = notarytool; sourceTree = "<group>"; };
BF0C828AF7BCC4F47E70B28F /* menubar-2.svg */ = {isa = PBXFileReference; lastKnownFileType = file.svg; path = "menubar-2.svg"; sourceTree = "<group>"; };
BF0C82C381FCBCF8109735AC /* pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = pl; path = InfoPlist.strings; sourceTree = "<group>"; };
BF0C82D44C2DFAA5D8F60394 /* sq */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = sq; path = Localizable.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1048,6 +1049,7 @@
D04BAD19B495AC18AC782A39 /* convert_font_to_png.sh */,
D04BA59FD487D0DEBBA66A94 /* createicns */,
BF0C86370093A080DD5974D8 /* convert_svg_to_png.sh */,
BF0C81D602ED642A48D50B78 /* notarytool */,
);
path = scripts;
sourceTree = "<group>";
Expand Down
Binary file added scripts/notarytool
Binary file not shown.
35 changes: 8 additions & 27 deletions scripts/package_and_notarize_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,21 @@ set -exu
version="$(cat $VERSION_FILE)"
appFile="$APP_NAME.app"
zipName="$APP_NAME-$version.zip"
bundleId="$(awk -F ' = ' '/PRODUCT_BUNDLE_IDENTIFIER/ { print $2; }' < config/base.xcconfig)"
oldPwd="$PWD"

cd "$XCODE_BUILD_PATH"
ditto -c -k --keepParent "$appFile" "$zipName"

# request notarization
requestUuid=$(xcrun altool \
--notarize-app \
--primary-bundle-id "$bundleId" \
--username "$APPLE_ID" \
requestStatus=$("$oldPwd"/scripts/notarytool submit \
--apple-id "$APPLE_ID" \
--password "$APPLE_PASSWORD" \
--file "$zipName" 2>&1 |
--team-id "$APPLE_TEAM_ID" \
"$zipName" \
--wait --timeout 15m 2>&1 |
tee /dev/tty |
awk '/RequestUUID/ { print $NF;exit; }')
if [[ $requestUuid == "" ]]; then exit 1; fi

# poll notarization status until success/invalid, or 15min have passed
requestStatus="in progress"
timeoutCounter=0
until [[ "$requestStatus" == "success" ]] || [[ "$requestStatus" == "invalid" ]] || [[ $timeoutCounter -eq 1500 ]]; do
sleep 10
timeoutCounter=$((timeoutCounter+10))
set +e
requestLogs=$(xcrun altool \
--notarization-info "$requestUuid" \
--username "$APPLE_ID" \
--password "$APPLE_PASSWORD" 2>&1)
set -e
requestStatus=$(echo "$requestLogs" | awk -F ': ' '/Status:/ { print $2; }')
done
if [[ $requestStatus != "success" ]]; then
echo "$requestLogs" | awk -F ': ' '/LogFileURL:/ { print $2; }' | xargs curl
exit 1
fi
awk -F ': ' '/ status:/ { print $2; }')
if [[ $requestStatus != "Accepted" ]]; then exit 1; fi

# staple build
xcrun stapler staple "$appFile"
Expand Down

0 comments on commit 7d823dd

Please sign in to comment.