How to automagically deploy to Testflight using Travis-CI
- Copy the .travis.yml into your repo and edit it
- Replace [Workspace name] with your workspace name. If you don't have a .workspace file and wish to use your .xcodeproj file replace the -workspace flag with a -project flag followed by your project name.
- Replace [Scheme to use] with the Scheme you wish to use.
- Replace [Build configuration name] with the build configuration you want to use.
- Replace [Comma separated Testflight distributions lists] with the Testflight distributions lists.
- Replace [Name of .app file] with the name of your App. In most cases it's same name as your project name.
- Replace [Organization name] with the name of the organization defined in the certificate you will use to sign this App. You'll find this in your keychain. If the certificate has ([User ID]) at the end, don't forget to update [User ID]. If not, delete ([User ID]) and the brackets surrounding it.
- Replace [Name of provisioning file] with the file name of your provisioning file name without the extension.
- Create the folders "scripts/travis/profile"
- Export the following things from the Keychain app
- "Apple Worldwide Developer Relations Certification Authority" to scripts/travis/apple.cer
- Your iPhone Distribution certificate to scripts/travis/dist.cer
- Your iPhone Distribution private key to scripts/travis/dist.p12 (Important to choose a proper password)
- Execute
travis encrypt "KEY_PASSWORD=[Your .p12 password]" --add
- Execute
travis encrypt "TEAM_TOKEN=[Testflight team token]" --add
- You'll find your Team token here
- Execute
travis encrypt "API_TOKEN=[Testflight API token]" --add
- You'll find your API token here
- Copy add-key.sh, remove-key.sh and testflight.sh to scripts/travis
- Copy your mobile provisioning profile to scripts/travis/profile/
- Stage all the new files, it should be:
- .travis.yml
- apple.cer
- dist.cer
- dist.p12
- [Name of provisioning file].mobileprovision
- add-key.sh
- remove-key.sh
- testflight.sh
- Commit and push!
- That's a Wrapp! ;)
In testflight.sh on row 6 we check which branch is being built. At the moment it will only send it to Testflight if the current branch is named "build_testflight". Feel free to remove this if it doesn't suit your needs :)
Thanks @boekkooi, added it :)