Skip to content

Instantly share code, notes, and snippets.

@mokagio
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mokagio/bae969dd8e3846ef7773 to your computer and use it in GitHub Desktop.
Save mokagio/bae969dd8e3846ef7773 to your computer and use it in GitHub Desktop.
Configurable script to build and distribute iOS apps to TestFlight. It relies on deliver, https://github.com/KrauseFx/deliver, and xcpretty, https://github.com/supermarin/xcpretty.
# iTunes Connect username
DELIVER_USER=my.apple.id@mail.com
# iTunes Connect password
DELIVER_PASSWORD=password
#!/bin/bash
name="MyAwesomeApp"
workspace="${name}.xcworkspace"
scheme=$name
configuration="Release"
archive_path="${name}.xcarchive"
ipa_path="${name}.ipa"
# make sure that this provisioning profile and its key are in the machine keychain
provisioning_profile="Distribution Provisioning Profile"
# remove any previous artifact, or xcodebuild will not proceed
rm -rf $archive_path
rm -rf $ipa_path
# create archive
xcrun xcodebuild \
-workspace "$workspace" \
-scheme "$scheme" \
-configuration "$configuration" \
-sdk iphoneos \
-destination generic/platform=iOS \
-archivePath "$archive_path" \
clean archive \
| bundle exec xcpretty -c
# export into ipa
xcrun xcodebuild \
-exportArchive \
-exportFormat IPA \
-archivePath "$archive_path" \
-exportPath "$ipa_path" \
-exportProvisioningProfile "$provisioning_profile" \
| bundle exec xcpretty -c
# submit to TestFlight
# username and password are picked from the .env file
env $(cat .env | grep -v "#" | xargs) bundle exec deliver testflight "$ipa_path"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment