-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_macos.sh
executable file
·58 lines (46 loc) · 1.24 KB
/
build_macos.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# Check that OS is macOS
if [[ "$OSTYPE" != "darwin"* ]]; then
echo "This script is only for macOS"
exit 1
fi
# Check that Xcode is installed
if ! command -v xcodebuild &> /dev/null; then
echo "Xcode is not installed"
exit 1
fi
# Check that Xcode command line tools are installed
if ! command -v xcode-select &> /dev/null; then
echo "Xcode command line tools are not installed"
exit 1
fi
# Parse arguments
if [ $# -ne 2 ]; then
echo "Usage: $0 <apple_id> <apple_id_password>"
exit 1
fi
export MAC_CODE_SIGNER="Developer ID Application: Monterey Bay Aquarium Research Institute (9TN7A342V4)"
export TEAM_ID="9TN7A342V4"
export APPLE_ID=$1
export APPLE_ID_PASSWORD=$2
# Build and sign
pyinstaller -y run.spec
# Zip
cd dist
ditto -c -k --keepParent "VARS GridView.app" "VARS GridView.zip"
# Notarize
xcrun notarytool submit "VARS GridView.zip" \
--wait \
--team-id "$TEAM_ID" \
--apple-id "$APPLE_ID" \
--password "$APPLE_ID_PASSWORD"
# Exit if notarization failed
if [ $? -ne 0 ]; then
echo "Notarization failed"
exit 1
fi
# Staple
xcrun stapler staple "VARS GridView.app"
rm "VARS GridView.zip"
# Repack for distribution
ditto -c -k --keepParent "VARS GridView.app" "VARS GridView.zip"