Slides from "Automate your iOS deployment a bit" presentation I gave at Cocoheads Tricity on 27th of May, 2015.
Read more at blog.brightinventions.pl.
Reach us at info@brightinventions.pl.
1. Automate your iOS deployment a bit
Michał Łukasiewicz
michal.lukasiewicz@brightinventions.pl
1 / 30
2. Agenda
1. Generate iOS project
2. Build your app from the command line
3. Upload to TestFlight, HockeyApp, etc.
4. Run it all on TeamCity
2 / 30
3. Disclaimer
What I show is based strictly on our own experience.
It's all in early phase.
Hopefully we got at least something right.
3 / 30
4. We don't love XCode project files
We might not be alone in this dislike
Hours wasted on merge problems
Hours wasted on code-signing issues
And we didn't learn nothing
4 / 30
10. XCode project hell - tip 4
The way Google deals with merge conflicts in .pbxproj files:
They don’t.
.pbxproj files are created using GYP from a specification designed
to be human-readable and mergable.
Neat! That’s the kind of thing I find useful for working around Xcode.
Posted by Jason Felice Jan 5th, 2013
http://objvimmer.com/blog/2013/01/05/pbxproj-merge-hell/
10 / 30
11. GYP - Generate Your Projects
GYP (Generate Your Projects) is a build automation tool.
GYP is created by Google to generate native IDE project files (such as Visual
Studio and Xcode) for building the Chromium web browser and is licensed as
open source software using the BSD software license.
http://en.wikipedia.org/wiki/GYP_software
11 / 30
13. GYP in practise
A single .gyp file that describes where your sources are and what targets
to create
gyp Foo.gyp # generates Foo.xcodeproj
.gitignore all project files
*.xcodeproj/
*.xcworkspace/
don't worry if you mess anything up
install GYP
brew tap mgamer/homebrew-taps
brew install gyp
13 / 30
14. Creating a new project
We have a few special needs:
configure GYP
setup sensible .gitignore
disable storyboards
integrate Podfile
there are a few Pods that we use most of the time
Not that easy to do it all manually, especially if you want to do something
quickly.
14 / 30
15. generate-ios
generate-ios is a small Yeoman generator that lets you create a fresh project
structure from the command line
15 / 30
20. Fastfile
To run lane appstore execute from command line:
fastlane appstore
20 / 30
21. Bright model
Store nothing more than necessary source code and resources in the
repository
Generate project using GYP
Install Pods after project generation
Use Fastlane to build and distribute the app
21 / 30
22. Bright Fastlane details
Store certificate and private key in the repository
In build script we create a temporary keychain, import certificate and
private key into that keychain and we tell xctool to use that keychain
ipa and dSYM files are stored in out/ directory
Special Fastlane lane called once that downloads certificate and private
key and puts it in the repository
22 / 30
24. Fastlane "once"
We define a special :once lane that:
creates an app in Apple Developer Account and iTunesConnect (using
Produce)
creates certificate (using Cert)
downloads certificate, find matching private key and stores it all in the
scripts/certs directory (using key4cert)
Thanks to this everybody can build the project without any code-signing
mess!
24 / 30
25. Fastlane "build"
Build lane builds the project :)
creates a temporary keychain
imports stored certificate and private key into temporary keychain
downloads and installs provisioning profile (using Sigh)
build the app using build.sh script
25 / 30