A bash script that builds, codesigns, and archives your iOS app. Works great on its own or with a continuous integration tool like Jenkins.
SSBuild performs these steps:
- Downloads and installs your distribution provisioning profiles from Apple's Developer Center
- Updates your app's major (marketing) and minor (build) version numbers
- Installs your Cocoapods
- Unlocks the OS X keychain to prepare for code signing
- Builds, codesigns, and archives your app into an IPA
- Zips your app's .dSYM.
- (Optional) Repeats steps 3-6 for an Adhoc (Testflight/Hockeyapp) build
- (Optional) Archives important build artifacts -- your IPA and .dSYM -- and uploads them to Amazon S3
The fun doesn't stop there. Read on to see how to configure Jenkins for even more goodness:
- Distribute your Adhoc build IPA and .dSYM to a beta service like Testflight or Hockeyapp
- Send a push notification to your iOS devices with the ultimate outcome of all previous steps - success or failure.
SSBuild powers continuous integration, packaging, archiving, Adhoc distributions, and notifications for my app MUDRammer - A Modern MUD Client for iPhone and iPad.
You may have some custom build steps or requirements. SSBuild is meant to be forked - make it your own!
Continuous integration means knowing your app is always in a releasable state. Even if you don't have or integration or UI tests, and regardless whether you're an indie solo developer or a massive faceless megacorp, CI will save you hours of time. With CI you need not muck about with provisioning profiles, you completely sidestep codesigning hell, and you spend more time coding.
CI means clicking one button and out pops your IPA, ready to be submitted to Apple.
- Cupertino downloads your provisioning profiles from Apple's developer center:
[sudo] gem install cupertino
- Cocoapods is the Objective-C package manager. You're using pods, right?
[sudo] gem install cocoapods
- xcpretty formats Apple's
xcodebuild
output, which is exceptionally verbose, into something much more human-readable.[sudo] gem install xcpretty
- An active iOS developer account and an app to build
- Optional: s3cmd for uploading build artifacts to Amazon S3.
SSBuild will attempt to install cupertino
, cocoapods
, and xcpretty
with the included Gemfile
.
You'll need 3 things to get started:
- The
SSBuild.sh
script from this repo - A config file for your app. Check out the sample
MyApp.config
and modify it to suit your needs. Keep in mind that yourMyApp.config
file CONTAINS SECRETS and SHOULD NOT BE CHECKED INTO VERSION CONTROL. - Location of and password to a keychain containing your codesigning certificate and private key. Chances are you already have these items in your user's main login keychain. Consider creating a new keychain file (Keychain Access -> File -> New Keychain...) that contains just your iOS codesigning identity and private key. Make sure to password-protect your new keychain and consider checking it into version control.
The SSBuild.sh
script takes just one argument: the path to your MyApp.config
file. Here's how you might run it:
./SSBuild.sh "/path/to/MyApp.config"
SSBuild.sh
works great on its own, but it really shines when you include it in a CI tool like Jenkins.
I use the Jenkins Testflight plugin to automatically upload my Adhoc IPA and .dSYM file to Testflight after every build. I prefer this plugin over a manual upload script because the plugin can include your commit history in the testflight build notes.
My Jenkins server sends me a push notification with the result of every build. There's a few pieces involved:
- Pushover is a fantastic iOS app and web service for sending push notifications to your devices.
The pushover script itself is super simple:
curl -s \
-F "token=PushoverToken" \
-F "user=Pushover-User-Or-Group" \
-F "message=Hello world" \
-F "url=My-Build-URL" \
https://api.pushover.net/1/messages.json
Ideally we want our push notification's message to include the final result status of our build. I've wired this up through the use of two separate post-build scripts, so each build fires only one success or failure script depending on its status.
SSBuild
is a @jhersh production -- (electronic mail | @jhersh)