Skip to content

Commit fc423db

Browse files
authored
tools: drop support for osx notarization with gon
Refs: nodejs/build#3385 (comment) PR-URL: #50291 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 4f0a7ae commit fc423db

File tree

1 file changed

+27
-52
lines changed

1 file changed

+27
-52
lines changed

tools/osx-notarize.sh

+27-52
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
#!/bin/sh
22

33
# Notarize a generated node-<version>.pkg file as an Apple requirement for installation on macOS Catalina and later, as validated by Gatekeeper.
4-
# Uses gon (Xcode version < 13.0) or notarytool (Xcode >= 13.0).
4+
# Uses notarytool and requires Xcode >= 13.0.
55

66
version() {
77
echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }' || echo "0"
88
}
99

10-
xcode_version=$(xcodebuild -version | awk '/Xcode/ {print $2}')
11-
xcode_version_result=$(version "$xcode_version")
12-
xcode_version_threshold=$(version "13.0")
1310
pkgid="$1"
1411

1512
if [ -z "$pkgid" ]; then
@@ -33,55 +30,33 @@ if [ -z "$NOTARIZATION_TEAM_ID" ]; then
3330
exit 0
3431
fi
3532

36-
# TODO(@ulisesGascon): remove support for gon
37-
# when https://github.com/nodejs/build/issues/3385#issuecomment-1729281269 is ready
38-
if [ "$xcode_version_result" -lt "$xcode_version_threshold" ]; then
39-
echo "Notarization process is done with gon."
40-
set -x
41-
42-
gon_version="0.2.2"
43-
gon_exe="${HOME}/.gon/gon_${gon_version}"
44-
45-
mkdir -p "${HOME}/.gon/"
46-
47-
if [ ! -f "${gon_exe}" ]; then
48-
curl -sL "https://github.com/mitchellh/gon/releases/download/v${gon_version}/gon_${gon_version}_macos.zip" -o "${gon_exe}.zip"
49-
(cd "${HOME}/.gon/" && rm -f gon && unzip "${gon_exe}.zip" && mv gon "${gon_exe}")
50-
fi
33+
echo "Notarization process is done with Notarytool."
5134

52-
sed -e "s/{{appleid}}/${NOTARIZATION_ID}/" -e "s/{{pkgid}}/${pkgid}/" tools/osx-gon-config.json.tmpl \
53-
> gon-config.json
54-
55-
"${gon_exe}" -log-level=info gon-config.json
35+
if ! command -v xcrun notarytool > /dev/null
36+
then
37+
echo "Notarytool is not present in the system. Notarization has failed."
38+
exit 1
39+
fi
5640

41+
# Submit the package for notarization
42+
# TODO(@ulisesGascon): refactor to use --keychain-profile
43+
# when https://github.com/nodejs/build/issues/3385#issuecomment-1729281269 is ready
44+
notarization_output=$(
45+
xcrun notarytool submit \
46+
--apple-id "$NOTARIZATION_ID" \
47+
--password "$NOTARIZATION_PASSWORD" \
48+
--team-id "$NOTARIZATION_TEAM_ID" \
49+
--wait \
50+
"node-$pkgid.pkg" 2>&1
51+
)
52+
53+
if [ $? -eq 0 ]; then
54+
# Extract the operation ID from the output
55+
operation_id=$(echo "$notarization_output" | awk '/RequestUUID/ {print $NF}')
56+
echo "Notarization submitted. Operation ID: $operation_id"
57+
exit 0
5758
else
58-
echo "Notarization process is done with Notarytool."
59-
60-
if ! command -v xcrun notarytool > /dev/null
61-
then
62-
echo "Notarytool is not present in the system. Notarization has failed."
63-
exit 1
64-
fi
65-
66-
# Submit the package for notarization
67-
# TODO(@ulisesGascon): refactor to use --keychain-profile
68-
# when https://github.com/nodejs/build/issues/3385#issuecomment-1729281269 is ready
69-
notarization_output=$(
70-
xcrun notarytool submit \
71-
--apple-id "$NOTARIZATION_ID" \
72-
--password "$NOTARIZATION_PASSWORD" \
73-
--team-id "$NOTARIZATION_TEAM_ID" \
74-
--wait \
75-
"node-$pkgid.pkg" 2>&1
76-
)
77-
78-
if [ $? -eq 0 ]; then
79-
# Extract the operation ID from the output
80-
operation_id=$(echo "$notarization_output" | awk '/RequestUUID/ {print $NF}')
81-
echo "Notarization submitted. Operation ID: $operation_id"
82-
exit 0
83-
else
84-
echo "Notarization failed. Error: $notarization_output"
85-
exit 1
86-
fi
59+
echo "Notarization failed. Error: $notarization_output"
60+
exit 1
8761
fi
62+

0 commit comments

Comments
 (0)