|
2 | 2 | # Build a self-contained MeetingTranscriber.app bundle. |
3 | 3 | # |
4 | 4 | # Usage: |
5 | | -# ./scripts/build_release.sh [--no-notarize] [--appstore] |
| 5 | +# ./scripts/build_release.sh [--no-notarize] [--staple] [--appstore] |
6 | 6 | # |
7 | 7 | # Output: |
8 | 8 | # .build/release/MeetingTranscriber.dmg |
@@ -30,11 +30,13 @@ MACOS_DIR="$CONTENTS/MacOS" |
30 | 30 | RESOURCES="$CONTENTS/Resources" |
31 | 31 |
|
32 | 32 | NOTARIZE=true |
| 33 | +STAPLE=false |
33 | 34 | APPSTORE=false |
34 | 35 | OVERRIDE_VERSION="" |
35 | 36 | for arg in "$@"; do |
36 | 37 | case "$arg" in |
37 | 38 | --no-notarize) NOTARIZE=false ;; |
| 39 | + --staple) STAPLE=true ;; |
38 | 40 | --appstore) APPSTORE=true ;; |
39 | 41 | --version=*) OVERRIDE_VERSION="${arg#--version=}" ;; |
40 | 42 | esac |
|
48 | 50 | fi |
49 | 51 | echo "Building MeetingTranscriber v${VERSION}" |
50 | 52 | echo " Notarize: $NOTARIZE" |
| 53 | +echo " Staple: $STAPLE" |
51 | 54 | echo " App Store: $APPSTORE" |
52 | 55 | echo "=======================================" |
53 | 56 |
|
@@ -135,6 +138,31 @@ if [ "$NOTARIZE" = true ]; then |
135 | 138 | --options runtime --timestamp --entitlements "$ENTITLEMENTS" \ |
136 | 139 | "$APP_BUNDLE" |
137 | 140 | echo " Signed with Developer ID for notarization" |
| 141 | + |
| 142 | + # When --staple is set, notarize and staple the .app itself so Gatekeeper |
| 143 | + # does not need to contact Apple online when the app is launched (cask |
| 144 | + # installs strip the DMG context, so the DMG ticket alone is not sufficient). |
| 145 | + if [ "$STAPLE" = true ]; then |
| 146 | + if [ -z "${APPLE_ID:-}" ] || [ -z "${TEAM_ID:-}" ] || [ -z "${APP_PASSWORD:-}" ]; then |
| 147 | + echo " ERROR: APPLE_ID, TEAM_ID, and APP_PASSWORD must be set for notarization." |
| 148 | + exit 1 |
| 149 | + fi |
| 150 | + |
| 151 | + echo " Notarizing .app bundle..." |
| 152 | + APP_ZIP="$BUILD_DIR/MeetingTranscriber-app.zip" |
| 153 | + rm -f "$APP_ZIP" |
| 154 | + ditto -c -k --keepParent "$APP_BUNDLE" "$APP_ZIP" |
| 155 | + xcrun notarytool submit "$APP_ZIP" \ |
| 156 | + --apple-id "$APPLE_ID" \ |
| 157 | + --team-id "$TEAM_ID" \ |
| 158 | + --password "$APP_PASSWORD" \ |
| 159 | + --wait |
| 160 | + rm -f "$APP_ZIP" |
| 161 | + |
| 162 | + echo " Stapling notarization ticket to .app..." |
| 163 | + xcrun stapler staple "$APP_BUNDLE" |
| 164 | + xcrun stapler validate "$APP_BUNDLE" |
| 165 | + fi |
138 | 166 | else |
139 | 167 | # Use local development certificate if available (extract 40-char hex SHA-1 hash) |
140 | 168 | SIGN_HASH=$(security find-identity -v -p codesigning 2>/dev/null | grep -oE '[0-9A-F]{40}' | head -1) |
@@ -187,13 +215,22 @@ if [ -z "${HOMEBREW_TEMP:-}" ]; then |
187 | 215 | exit 1 |
188 | 216 | fi |
189 | 217 |
|
| 218 | + WAIT_FLAG="" |
| 219 | + [ "$STAPLE" = true ] && WAIT_FLAG="--wait" |
| 220 | + |
190 | 221 | xcrun notarytool submit "$DMG_PATH" \ |
191 | 222 | --apple-id "$APPLE_ID" \ |
192 | 223 | --team-id "$TEAM_ID" \ |
193 | | - --password "$APP_PASSWORD" |
194 | | - |
195 | | - echo " DMG submitted for notarization (no --wait, no staple)" |
196 | | - echo " Gatekeeper will verify online when users open the DMG" |
| 224 | + --password "$APP_PASSWORD" \ |
| 225 | + $WAIT_FLAG |
| 226 | + |
| 227 | + if [ "$STAPLE" = true ]; then |
| 228 | + echo " Stapling notarization ticket to DMG..." |
| 229 | + xcrun stapler staple "$DMG_PATH" |
| 230 | + xcrun stapler validate "$DMG_PATH" |
| 231 | + else |
| 232 | + echo " DMG submitted for notarization (Gatekeeper will verify online)" |
| 233 | + fi |
197 | 234 | fi |
198 | 235 | else |
199 | 236 | echo "" |
|
0 commit comments