Skip to content

Instantly share code, notes, and snippets.

@lukeredpath
Created July 30, 2014 11:40
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukeredpath/98a0e63e4ef695b17829 to your computer and use it in GitHub Desktop.
Save lukeredpath/98a0e63e4ef695b17829 to your computer and use it in GitHub Desktop.
My Travis CI iOS deployment/build setup
language: objective-c
rvm: 2.1.1
install: bundle
before_script: ./script/add-key.sh
after_script: ./script/remove-key.sh
script: ./script/travis.sh
env:
global:
- LANG=en_US.UTF-8
- LC_ALL=en_US.UTF-8
notifications:
email: false
#!/bin/sh
security create-keychain -p travis ios-build.keychain
security import ./script/certs/apple.cer -k ~/Library/Keychains/ios-build.keychain -T /usr/bin/codesign
security import ./script/certs/distribution.p12 -k ~/Library/Keychains/ios-build.keychain -P $KEY_PASSWORD -T /usr/bin/codesign
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp ./script/certs/$PROVISIONING_PROFILE_NAME.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
#!/bin/sh
security delete-keychain ios-build.keychain
rm -f ~/Library/MobileDevice/Provisioning\ Profiles/$PROVISIONING_PROFILE_NAME.mobileprovision
#!/bin/sh
echo "Building and running unit tests"
rake test
if [[ $? != 0 ]]; then
echo "Tests failed, exiting."
exit 1
fi
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo "This is a pull request. No deployment will be done."
exit 0
fi
if [[ "$TRAVIS_BRANCH" != "release/beta" ]]; then
echo "Testing on a branch other than release/beta. No deployment will be done."
exit 0
fi
RELEASE_DATE=`date '+%Y-%m-%d %H:%M:%S'`
TF_RELEASE_NOTES="Build: $TRAVIS_BUILD_NUMBER\nUploaded: $RELEASE_DATE"
# Travis now use Mavericks which requires the keychain is default and unlocked
# see: http://docs.travis-ci.com/user/common-build-problems/#Mac%3A-Code-Signing-Errors
# Make the keychain the default so identities are found
security default-keychain -s ios-build.keychain
# Unlock the keychain
security unlock-keychain -p travis ios-build.keychain
# Set keychain locking timeout to 3600 seconds
security set-keychain-settings -t 3600 -u ios-build.keychain
echo "Packagaing and deploying build to TestFlight"
rake deploy
@lukeredpath
Copy link
Author

I package up my build/tests tasks using Rake so the above scripts delegate to rake tasks for the actual building but you could do it inline instead.

@oriolblanc
Copy link

How do you execute xctool to generate the proper IPA? What's rake deploy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment