Skip to content

Commit c95802e

Browse files
Merge pull request #5124 from swiftwasm/katei/notarytool
Move from altool to notarytool for notarization
2 parents b4b4a2e + 289ab79 commit c95802e

File tree

1 file changed

+7
-30
lines changed

1 file changed

+7
-30
lines changed

utils/webassembly/distribute-latest-toolchain.sh

Lines changed: 7 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ targets=($TARGETS_TO_DIST)
1212
DARWIN_TOOLCHAIN_APPLICATION_CERT=${DARWIN_TOOLCHAIN_APPLICATION_CERT:?"Please set DARWIN_TOOLCHAIN_APPLICATION_CERT"}
1313
DARWIN_TOOLCHAIN_INSTALLER_CERT=${DARWIN_TOOLCHAIN_INSTALLER_CERT:?"Please set DARWIN_TOOLCHAIN_APPLICATION_CERT"}
1414
DARWIN_TOOLCHAIN_NOTARIZE_EMAIL=${DARWIN_TOOLCHAIN_NOTARIZE_EMAIL:?"Please set DARWIN_TOOLCHAIN_NOTARIZE_EMAIL"}
15+
DARWIN_TOOLCHAIN_NOTARIZE_TEAM_ID=${DARWIN_TOOLCHAIN_NOTARIZE_TEAM_ID:?"Please set DARWIN_TOOLCHAIN_NOTARIZE_TEAM_ID"}
1516

1617
gh_api=https://api.github.com
1718

@@ -130,37 +131,13 @@ create_installer() {
130131
"${darwin_toolchain_version}" "${swift_source_dir}/utils/darwin-installer-scripts"
131132

132133
# Notarize the toolchain installer
133-
local notarize_command=("xcrun" "altool" "--notarize-app" "--type" "osx" \
134-
"--file" "${darwin_toolchain_installer_package}" \
135-
"--primary-bundle-id" "${darwin_toolchain_bundle_identifier}" \
136-
"-u" "${DARWIN_TOOLCHAIN_NOTARIZE_EMAIL}" \
137-
"-p" "@env:DARWIN_TOOLCHAIN_NOTARIZE_PASSWORD")
138-
139-
if [ -n "${DARWIN_TOOLCHAIN_NOTARIZE_TEAM_ID}" ]; then
140-
notarize_command=("${notarize_command[@]}" "--asc-provider" "${DARWIN_TOOLCHAIN_NOTARIZE_TEAM_ID}")
141-
fi
142-
143-
local request_output=$(${notarize_command[@]})
134+
xcrun notarytool submit "${darwin_toolchain_installer_package}" \
135+
--wait \
136+
--apple-id "${DARWIN_TOOLCHAIN_NOTARIZE_EMAIL}" \
137+
--team-id "${DARWIN_TOOLCHAIN_NOTARIZE_TEAM_ID}" \
138+
--password "${DARWIN_TOOLCHAIN_NOTARIZE_PASSWORD}"
144139

145-
local request_uuid=$(echo "$request_output" | grep "RequestUUID = " | awk '{print $3}')
146-
147-
local request_status=$(xcrun altool --notarization-info "$request_uuid" \
148-
-u "${DARWIN_TOOLCHAIN_NOTARIZE_EMAIL}" \
149-
-p "@env:DARWIN_TOOLCHAIN_NOTARIZE_PASSWORD")
150-
# Wait until finished
151-
while echo "$request_status" | grep -q "Status: in progress" ; do
152-
sleep 60
153-
request_status=$(xcrun altool --notarization-info "$request_uuid" \
154-
-u "${DARWIN_TOOLCHAIN_NOTARIZE_EMAIL}" \
155-
-p "@env:DARWIN_TOOLCHAIN_NOTARIZE_PASSWORD")
156-
done
157-
158-
if echo "$request_status" | grep -q "Status: success"; then
159-
xcrun stapler staple "${darwin_toolchain_installer_package}"
160-
else
161-
echo "Failed to notarize the toolchain $darwin_toolchain_installer_package: $request_status"
162-
exit 1
163-
fi
140+
xcrun stapler staple "${darwin_toolchain_installer_package}"
164141
}
165142

166143
package_darwin_toolchain() {

0 commit comments

Comments
 (0)