#!/usr/bin/env bash # # dist-ios-adhoc.sh — build an ad-hoc IPA of the iOS client and the files needed to # install it on registered devices from an HTTPS web page (itms-services OTA install). # # This is for handing the app to a handful of friends BEFORE TestFlight. Ad-hoc builds # only run on devices whose UDID is registered in your Apple Developer account, so the # script registers UDIDs (via the App Store Connect API) before it signs. # # Pipeline: # 1. Register each --udid with App Store Connect (idempotent; skip with --skip-register). # 2. Build VoiceCatCore.xcframework (iOS device slice). # 3. xcodebuild archive (Release, generic/platform=iOS), letting Xcode auto-create the # ad-hoc Distribution cert + profile via -allowProvisioningUpdates + the API key. # 4. xcodebuild -exportArchive with method=release-testing (Xcode's modern name for # "ad-hoc") -> VoiceCatiOS.ipa. # 5. Generate manifest.plist (OTA install manifest) + index.html (install page). # 6. Stage VoiceCatiOS.ipa + manifest.plist + index.html into dist/ios-adhoc/. # # You then upload those three files to your HTTPS host and open index.html on the iPhone. # # Prerequisites (one-time, not scriptable): # - Paid Apple Developer Program membership (Team ID is already set in the project). # - An App Store Connect API "Team Key" (.p8) with Admin or App Manager access: # App Store Connect -> Users and Access -> Integrations -> App Store Connect API. # Note its Key ID and Issuer ID. Keep the .p8 out of the repo. # - Each friend's device UDID (read it in Finder with the iPhone connected to a Mac). # # Auth — supply via env vars (or the matching flags): # ASC_KEY_ID App Store Connect API Key ID (--key-id) # ASC_ISSUER_ID App Store Connect API Issuer ID (--issuer-id) # ASC_KEY_PATH path to AuthKey_XXXXXXXXXX.p8 (--key) # # Usage: # scripts/dist-ios-adhoc.sh --udid --name "Friend iPhone" \ # --base-url https://example.com/voicecat # scripts/dist-ios-adhoc.sh --udids-file friends.csv --base-url https://example.com/vc # scripts/dist-ios-adhoc.sh --skip-register --base-url https://example.com/vc # rebuild only # scripts/dist-ios-adhoc.sh --dist /out --no-configure # scripts/dist-ios-adhoc.sh -h|--help # # Flags: # --udid device to register (repeatable). Pair with an optional --name. # --name