Building an iOS project with Hudson

I'm mostly writing this here for archival purposes. This is how I used to build iOS projects via Hudson (I don't have any iOS projects ongoing).

First, since Hudson runs on a Linux machine, I need to add a new node then start the agent on an OSX machine from an account where I have all the digital keys set up properly.

Next, supposing I have an iOS app called Example, I just tell Hudson to poll the SCM then execute the script:

TIME=`date "+%Y-%m-%d_%H-%M-%S"`;


rm -r build || true;


xcodebuild -target Example -configuration Distribution -sdk iphoneos3.1.2 clean build


  && 


  (mkdir build/Distribution-iphoneos/Payload; mv build/Distribution-iphoneos/Example.app build/Distribution-iphoneos/Payload)
  
  && 
  
  (cd build/Distribution-iphoneos && zip -9 "example-$TIME.ipa" -r Payload)

Afterwards Hudson just needs to "Archive the artifacts" from build/Distribution-iphoneos/*.ipa


Obviously you need to tweak the sdk version a bit as this script is for an older 3.1 app but this is the gist of it.

Now you just have Hudson doing builds as soon as a commit comes up and you can send updates to customers by just grabbing the .ipa file from the Hudson site (or even give customers direct access to Hudson and have them download a build as soon as available).