A little thing I have done for work is to automatically build the latest code of our iOS projects and push the IPA to TestFlight. After spending a couple of hours trying to get Jenkins to do this, I was getting nowhere and gave up.
I spent about 20 minutes writing a bash script that did everything I needed, launched at 5:30pm via cronjob. The basic gist of it is below.
|cd /Shared\ Items/Public/AUTO/project|
|# Reset Git|
|git reset --hard|
|echo pulling latest|
|xcodebuild -workspace $NAME.xcworkspace -scheme $NAME -configuration $CONFIGURATION clean build ONLY_ACTIVE_ARCH=NO CONFIGURATION_BUILD_DIR="$BUILDDIR"|
|echo Generating .ipa file|
|xcrun -sdk iphoneos PackageApplication -v "$BUILDDIR/$NAME.app" -o "$BUILDDIR/$NAME.ipa"|
|# Zip the dSYM File|
|echo Generating zip file|
|/usr/bin/zip -r "$BUILDDIR/$NAME.app.dSYM.zip" "$BUILDDIR/$NAME.app.dSYM"|
|# Upload the build to TestFlight|
|echo Sending to TestFlight|
|/usr/bin/curl "http://testflightapp.com/api/builds.json " -F [email protected]"$BUILDDIR/$NAME.ipa" -F [email protected]"$BUILDDIR/$NAME.app.dSYM.zip" -F api_token="$API_TOKEN" -F team_token="$TEAM_TOKEN" -F notes="Build uploaded automatically from Xcode." -#|
This is okay for now.. But when I decide to do this for multiple iOS projects I think I will create a little node.js app that will manage projects and be similar to Jenkins. Watch this space.
(This scripts assumes that the build configuration that xcode is building is using the correct distribution that the provisioning profile that your testers on testflight are in)