summaryrefslogtreecommitdiff
path: root/bin/notarize-app
diff options
context:
space:
mode:
authorrejbasket <39080670+rejbasket@users.noreply.github.com>2021-12-08 22:18:41 +0100
committerGitHub <noreply@github.com>2021-12-08 22:18:41 +0100
commit41ace3a9e53b52b4271554d7aedd88d533ee5f5e (patch)
tree83dd3887459eeb79c95177bf318598ee01514fa1 /bin/notarize-app
parent49d0f88278798a6c061ce70dd6c1aafb0b1f7a6a (diff)
add macOS and windows installer (#1352)
Diffstat (limited to 'bin/notarize-app')
-rw-r--r--bin/notarize-app46
1 files changed, 46 insertions, 0 deletions
diff --git a/bin/notarize-app b/bin/notarize-app
new file mode 100644
index 00000000..4a2bbc41
--- /dev/null
+++ b/bin/notarize-app
@@ -0,0 +1,46 @@
+#!/bin/sh -u
+# source of this code: https://github.com/rednoah/notarize-app
+ASC_PROVIDER="$1"
+ASC_USERNAME="$2"
+ASC_PASSWORD="$3"
+
+BUNDLE_ID="$4"
+BUNDLE_PKG="$5"
+
+
+# create temporary files
+NOTARIZE_APP_LOG=$(mktemp -t notarize-app)
+NOTARIZE_INFO_LOG=$(mktemp -t notarize-info)
+
+# delete temporary files on exit
+function finish {
+ rm "$NOTARIZE_APP_LOG" "$NOTARIZE_INFO_LOG"
+}
+trap finish EXIT
+
+
+# submit app for notarization
+if xcrun altool --notarize-app --primary-bundle-id "$BUNDLE_ID" --asc-provider "$ASC_PROVIDER" --username "$ASC_USERNAME" --password "$ASC_PASSWORD" -f "$BUNDLE_PKG" > "$NOTARIZE_APP_LOG" 2>&1; then
+ cat "$NOTARIZE_APP_LOG"
+ RequestUUID=$(awk -F ' = ' '/RequestUUID/ {print $2}' "$NOTARIZE_APP_LOG")
+
+ # check status periodically
+ while sleep 60 && date; do
+ # check notarization status
+ if xcrun altool --notarization-info "$RequestUUID" --asc-provider "$ASC_PROVIDER" --username "$ASC_USERNAME" --password "$ASC_PASSWORD" > "$NOTARIZE_INFO_LOG" 2>&1; then
+ cat "$NOTARIZE_INFO_LOG"
+
+ # once notarization is complete, run stapler and exit
+ if ! grep -q "Status: in progress" "$NOTARIZE_INFO_LOG"; then
+ xcrun stapler staple "$BUNDLE_PKG"
+ exit $?
+ fi
+ else
+ cat "$NOTARIZE_INFO_LOG" 1>&2
+ exit 1
+ fi
+ done
+else
+ cat "$NOTARIZE_APP_LOG" 1>&2
+ exit 1
+fi