Skip to content

Instantly share code, notes, and snippets.

@SlaunchaMan
Last active February 21, 2019 08:34
Show Gist options
  • Save SlaunchaMan/8797641 to your computer and use it in GitHub Desktop.
Save SlaunchaMan/8797641 to your computer and use it in GitHub Desktop.
Enumerate all schemes in a project, archive them, and export as IPAs.
#!/bin/bash
# Builds all targets and places IPAs in build/
# Constants
SIGNING_IDENTITY="iPhone Distribution: Detroit Labs, LLC"
# Get a list of all schemes, then build each.
xcodebuild -project PROJECT.xcodeproj -list | \
sed -n '/Schemes/,/^$/p' | \
grep -v "Schemes:" | \
while read scheme; do
echo "Building ${scheme}…"
build_dir="$(pwd)/build"
archivePath="${build_dir}/Archives/${scheme}.xcarchive"
exportPath="${build_dir}/${scheme}.ipa"
xcodebuild -project PROJECT.xcodeproj \
-scheme "${scheme}" \
-configuration Release \
-sdk iphoneos \
archive \
-archivePath "${archivePath}" || exit $?
xcodebuild -exportArchive \
-exportFormat IPA \
-archivePath "${archivePath}" \
-exportPath "${exportPath}" \
-exportSigningIdentity "${SIGNING_IDENTITY}" || exit $?
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment