51 lines
1.3 KiB
Bash
51 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
cd "$ROOT_DIR"
|
|
|
|
if [[ "$(uname -s)" != "Darwin" ]]; then
|
|
printf 'Building an iOS IPA requires macOS and Xcode.\n' >&2
|
|
exit 1
|
|
fi
|
|
|
|
if ! command -v xcodebuild >/dev/null 2>&1; then
|
|
printf 'xcodebuild was not found. Install Xcode and its command line tools first.\n' >&2
|
|
exit 1
|
|
fi
|
|
|
|
npm run ios:sync
|
|
|
|
DERIVED_DATA_DIR="$ROOT_DIR/ios/App/DerivedData/UnsignedIPA"
|
|
APP_PATH="$DERIVED_DATA_DIR/Build/Products/Release-iphoneos/App.app"
|
|
OUTPUT_DIR="$ROOT_DIR/downloads/ios"
|
|
OUTPUT_IPA="$OUTPUT_DIR/BeatHound-iOS-1.0.0-unsigned.ipa"
|
|
PACKAGE_DIR="$(mktemp -d)"
|
|
trap 'rm -rf "$PACKAGE_DIR"' EXIT
|
|
|
|
xcodebuild \
|
|
-project ios/App/App.xcodeproj \
|
|
-scheme App \
|
|
-configuration Release \
|
|
-sdk iphoneos \
|
|
-destination 'generic/platform=iOS' \
|
|
-derivedDataPath "$DERIVED_DATA_DIR" \
|
|
CODE_SIGNING_ALLOWED=NO \
|
|
CODE_SIGNING_REQUIRED=NO \
|
|
CODE_SIGN_IDENTITY='' \
|
|
build
|
|
|
|
if [[ ! -d "$APP_PATH" ]]; then
|
|
printf 'Xcode completed without producing the expected app at %s\n' "$APP_PATH" >&2
|
|
exit 1
|
|
fi
|
|
|
|
mkdir -p "$PACKAGE_DIR/Payload" "$OUTPUT_DIR"
|
|
ditto "$APP_PATH" "$PACKAGE_DIR/Payload/App.app"
|
|
(
|
|
cd "$PACKAGE_DIR"
|
|
/usr/bin/zip -qry "$OUTPUT_IPA" Payload
|
|
)
|
|
|
|
printf 'Created %s\n' "$OUTPUT_IPA"
|