Skip to content

Instantly share code, notes, and snippets.

@inf0rmer
Created August 22, 2014 14:04
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 inf0rmer/bdd83c41ecd1adad6856 to your computer and use it in GitHub Desktop.
Save inf0rmer/bdd83c41ecd1adad6856 to your computer and use it in GitHub Desktop.
Automatically uploads a build to Testflight using Travis
!/bin/sh
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then
echo "This is a pull request. No deployment will be done."
exit 0
fi
if [[ "$TRAVIS_BRANCH" != "master" ]]; then
echo "Testing on a branch other than master. No deployment will be done."
exit 0
fi
echo "************************************"
echo "* Installing Dependencies *"
echo "************************************"
brew unlink imagemagick ghostscript
brew install imagemagick ghostscript
echo "********************"
echo "* Building *"
echo "********************"
xctool -workspace Clubjudge.xcworkspace -scheme Release -sdk iphoneos -configuration Release OBJROOT=$PWD/build SYMROOT=$PWD/build ONLY_ACTIVE_ARCH=NO
# Thanks @djacobs https://gist.github.com/djacobs/2411095
PROVISIONING_PROFILE="$HOME/Library/MobileDevice/Provisioning Profiles/$PROFILE_UUID.mobileprovision"
RELEASE_DATE=`date '+%Y-%m-%d %H:%M:%S'`
OUTPUTDIR="$PWD/build/Release-iphoneos"
echo "********************"
echo "* Signing *"
echo "********************"
xcrun -log -sdk iphoneos PackageApplication "$OUTPUTDIR/$APPNAME.app" -o "$OUTPUTDIR/$APPNAME.ipa" -sign "$DEVELOPER_NAME" -embed "$PROVISIONING_PROFILE"
RELEASE_NOTES="Build: $TRAVIS_BUILD_NUMBER\nUploaded: $RELEASE_DATE"
zip -r -9 "$OUTPUTDIR/$APPNAME.app.dSYM.zip" "$OUTPUTDIR/$APPNAME.app.dSYM"
echo "********************"
echo "* Uploading *"
echo "********************"
curl http://testflightapp.com/api/builds.json \
-F file="@$OUTPUTDIR/$APPNAME.ipa" \
-F dsym="@$OUTPUTDIR/$APPNAME.app.dSYM.zip" \
-F api_token="$API_TOKEN" \
-F team_token="$TEAM_TOKEN" \
-F distribution_lists='$DISTRIBUTION_LISTS' \
-F notes="$RELEASE_NOTES" -v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment