I've been trying to setup Travis CI as a build server, but am running into problems both code signing the app, and uploading it to TestFlight.
The main issue is uploading to Apple TestFlight. I can find a lot guides online on how to upload to the old version of TestFlight at testflightapp.com, but I've not figured out how to upload to iTunes Connect.
I attempted to use the altool
command:
altool --upload-app -f "$OUTPUTDIR/$APP_NAME.ipa" -u '$ITUNES_CONNECT_USERNAME' -p '$ITUNES_CONNECT_PASSWORD'
But on Travis CI it doesn't work:
altool: command not found
-
I've primarily used the following tutorials to get this far: http://www.raywenderlich.com/109418/travis-ci-tutorial and https://www.objc.io/issues/6-build-tools/travis-ci/#app-signing
This is a useful official page: http://docs.travis-ci.com/user/languages/objective-c/
-
This is my project setup:
.travis.yml file:
language: objective-c
osx_image: xcode7.1
xcode_workspace: XXXXXXX.xcworkspace
xcode_scheme: XXXXXXX
env:
global:
- APP_NAME="XXXXXX"
- DEVELOPER_NAME="iPhone Distribution: XXXXXXX (XXXXXXX)"
- PROFILE_NAME="XXXXXXXXXXXXX"
- ITUNES_CONNECT_USERNAME="XXXXXX@XXXXXX.com"
- secure: XXXXXXXXXXXXXXXXXXXXXX
before_script:
- ./scripts/add-key.sh
- ./scripts/update-bundle.sh
script:
- xctool -workspace XXXXXXX.xcworkspace -scheme XXXXXXX -sdk iphoneos -configuration
Release OBJROOT=$PWD/build SYMROOT=$PWD/build ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY=""
CODE_SIGNING_REQUIRED=NO
after_success:
- ./scripts/sign-and-upload.sh
after_script:
- ./scripts/remove-key.sh
Note that the CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
on the end of the build command is there because otherwise the app fails to build (see https://github.com/travis-ci/travis-ci/issues/3047 for details, and https://stackoverflow.com/a/11647504/404409 for more info on it). This is probably a cause of the code signing issue described below.
The add-key.sh, sign-and-upload.sh and remove-key.sh scripts are basically just copied direct from https://www.objc.io/issues/6-build-tools/travis-ci/#add-scripts
With the exception of this line being added the end of sign-and-upload.sh:
altool --upload-app -f "$OUTPUTDIR/$APP_NAME.ipa" -u '$ITUNES_CONNECT_USERNAME' -p '$ITUNES_CONNECT_PASSWORD'
-
The app builds, but this is the output from the sign-and-upload.sh script at the end:
env SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication /Users/travis/build/XXXXXX/ios/build/Release-iphoneos/XXXXXXX.app -o /Users/travis/build/XXXXXX/ios/build/Release-iphoneos/XXXXXXX.ipa -sign iPhone\ Distribution\=XXXXXXXXXXXX -embed /Users/travis/Library/MobileDevice/Provisioning\ Profiles/XXXXXXXXXXX.mobileprovision
error: Failed to read entitlements from '/var/folders/my/XXXXXXXXXXXXXXXXXXX/X/XXXXXXXXX/Payload/Kimono.app'
./scripts/sign-and-upload.sh: line 20: altool: command not found
-
If you have any clues as to how iOS apps should be done on Travis CI, or how to submit builds to TestFlight over the command line I would be eternally grateful!
Thank you.