-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxcode-dist.sh
executable file
·112 lines (93 loc) · 2.88 KB
/
xcode-dist.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
APP_NAME="lilDevil"
USERNAME="[email protected]"
KEYCHAIN="XcodeSecurity"
PASSWORD="@keychain:"${KEYCHAIN}
BUNDLE_ID="com.twelvechairs-software."${APP_NAME}
BUNDLE_PATH="/Users/vokamisair/Documents/dev/"${APP_NAME}"/dist/homebrew/"
DEVELOPER_ID="Developer ID Application: Twelve Chairs Software, LLC"
DEVELOPER_APPLICATION="3rd Party Mac Developer Application: Twelve Chairs Software, LLC"
DEVELOPER_INSTALLER="3rd Party Mac Developer Installer: Twelve Chairs Software, LLC"
## (Optional) Set Xcode as default build tool
#sudo xcode-select -s /Applications/Xcode.app
#
## (Optional) Save app-specific password to local keychain
# xcrun altool \
# --store-password-in-keychain-item ${KEYCHAIN} \
# -u ${USERNAME} \
# -p <PASSWORD>
#
#
# Clean up app bundle
xattr -cr ${BUNDLE_PATH}${APP_NAME}".app/"
# Code sign bundle (enable hardened runtime)
codesign \
-dvv ${BUNDLE_PATH}${APP_NAME}".app/" \
--sign ${DEVELOPER_ID} \
--options runtime \
--timestamp \
--force
codesign \
-dvv ${BUNDLE_PATH}${APP_NAME}".app/Contents/MacOS/"${APP_NAME} \
--sign ${DEVELOPER_ID} \
--options runtime \
--timestamp \
--force
spctl -vvv --assess --type exec ${BUNDLE_PATH}${APP_NAME}".app"
# Request app notarization
pushd ${BUNDLE_PATH}
rm -f ${APP_NAME}".zip"
zip -r ${APP_NAME}".zip" ${APP_NAME}".app"
popd
NOTARIZATION_ID=$(xcrun altool \
--notarize-app \
--primary-bundle-id ${BUNDLE_ID} \
-u ${USERNAME} \
-p ${PASSWORD} \
-f ${BUNDLE_PATH}${APP_NAME}".zip" | grep "RequestUUID = " | sed "s/RequestUUID = //")
rm -rf ${BUNDLE_PATH}${APP_NAME}".zip"
echo "Waiting for notarization results..."
sleep 360
# Check on status
xcrun altool \
--notarization-info ${NOTARIZATION_ID} \
-u ${USERNAME} \
-p ${PASSWORD}
# Staple the Ticket to Distro
xcrun stapler \
staple ${BUNDLE_PATH}${APP_NAME}".app"
codesign \
-dvv ${BUNDLE_PATH}${APP_NAME}".app/" \
--entitlements "entitlements" \
--sign ${DEVELOPER_APPLICATION} \
--options runtime \
--timestamp \
--force
codesign \
-dvv ${BUNDLE_PATH}${APP_NAME}".app/Contents/MacOS/"${APP_NAME} \
--entitlements "entitlements" \
--sign ${DEVELOPER_APPLICATION} \
--options runtime \
--timestamp \
--force
codesign \
--verify ${BUNDLE_PATH}${APP_NAME}".app/"
productbuild \
--component ${BUNDLE_PATH}${APP_NAME}".app" /Applications ${BUNDLE_PATH}${APP_NAME}".pkg" \
--sign ${DEVELOPER_INSTALLER}
# Validate app archive for the App Store
xcrun altool \
--validate-app \
-t "osx" \
-u ${USERNAME} \
-p ${PASSWORD} \
-f ${BUNDLE_PATH}${APP_NAME}".pkg"
#xcrun altool \
# --upload-app \
# -t "osx" \
# -u ${USERNAME} \
# -p ${PASSWORD} \
# -f ${BUNDLE_PATH}"lilDevil.pkg"
#
#
## Cleanup
#rm -rf ${BUNDLE_PATH}"lilDevil.app"