11#! /bin/bash
22# Build Claude Island for release
3- set -eo pipefail
3+ set -e
44
55SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
66PROJECT_DIR=" $( dirname " $SCRIPT_DIR " ) "
@@ -17,16 +17,22 @@ mkdir -p "$BUILD_DIR"
1717
1818cd " $PROJECT_DIR "
1919
20- # Build and archive
20+ # Build and archive — pipe to xcpretty when available, but capture the real
21+ # xcodebuild exit code so a noisy-but-successful xcpretty doesn't fail the build.
2122echo " Archiving..."
23+ set +e
2224xcodebuild archive \
2325 -scheme ClaudeIsland \
2426 -configuration Release \
2527 -archivePath " $ARCHIVE_PATH " \
2628 -destination " generic/platform=macOS" \
2729 ENABLE_HARDENED_RUNTIME=YES \
2830 CODE_SIGN_STYLE=Automatic \
29- 2>&1 | xcpretty || {
31+ 2>&1 | xcpretty
32+ ARCHIVE_EXIT=${PIPESTATUS[0]}
33+ set -e
34+
35+ if [ " $ARCHIVE_EXIT " -ne 0 ]; then
3036 echo " ERROR: Archive failed. Re-running with full output..."
3137 xcodebuild archive \
3238 -scheme ClaudeIsland \
@@ -36,7 +42,7 @@ xcodebuild archive \
3642 ENABLE_HARDENED_RUNTIME=YES \
3743 CODE_SIGN_STYLE=Automatic
3844 exit 1
39- }
45+ fi
4046
4147# Create ExportOptions.plist if it doesn't exist
4248EXPORT_OPTIONS=" $BUILD_DIR /ExportOptions.plist"
5864# Export the archive
5965echo " "
6066echo " Exporting..."
67+ set +e
6168xcodebuild -exportArchive \
6269 -archivePath " $ARCHIVE_PATH " \
6370 -exportPath " $EXPORT_PATH " \
6471 -exportOptionsPlist " $EXPORT_OPTIONS " \
65- 2>&1 | xcpretty || {
72+ 2>&1 | xcpretty
73+ EXPORT_EXIT=${PIPESTATUS[0]}
74+ set -e
75+
76+ if [ " $EXPORT_EXIT " -ne 0 ]; then
6677 echo " ERROR: Export failed. Re-running with full output..."
6778 xcodebuild -exportArchive \
6879 -archivePath " $ARCHIVE_PATH " \
6980 -exportPath " $EXPORT_PATH " \
7081 -exportOptionsPlist " $EXPORT_OPTIONS "
7182 exit 1
72- }
83+ fi
7384
7485echo " "
7586echo " === Build Complete ==="
0 commit comments