This guide will help you set up Continuous Delivery for your iOS project.
It will help you set up all needed build tools. I tested everything with a fresh Yosemite installation.
Installation • Setting up • Example Project • Help
-------If you don't want to use sudo, you can follow the CocoaPods Guide of a sudo-less installation.
See how Wikipedia, Product Hunt and MindNode use fastlane to automate their iOS submission process.
Requirements:
- Mac OS 10.9 or newer
- Ruby 2.0 or newer (
ruby -v) - Xcode
Additionally, to an Xcode installation, you also need the Xcode command line tools set up
xcode-select --install
If you have not used the command line tools before (which is likely if you just installed it), you'll need to accept the terms of service.
sudo xcodebuild -license accept
Install the gem and all its dependencies (this might take a few minutes).
sudo gem install fastlane --verbose
Before changing anything, I recommend committing everything in git (in case something goes wrong).
When running the setup commands, please read the instructions shown in the terminal. There is usually a reason they are there.
fastlane will create all necessary files and folders for you with the following command.
fastlane init
- Confirm until you get asked for your App Identifier.
- Enter the App Identifier (Bundle Identifier) of your project.
- Enter your Apple ID: The username, you enter when you login on iTunes Connect.
- If you haven't already used
deliver:- Confirm with
yto start the setup fordeliver. - If your app is already in the App Store, confirm with
yto automatically create a configuration for you. If it's not yet in the store, entern.
- Confirm with
- If you haven't already used
snapshot, confirm withyif you want your screenshots to be created automatically. - If you want to
sighto download, renew or create your provisioning profiles, confirm withy.
That's it, you should have received a success message.
What did this setup do?
- Created a
fastlanefolder - Moved existing
deliverandsnapshotconfiguration into thefastlanefolder (if they existed). - Created
fastlane/Appfile, which stores your Apple ID and Bundle Identifier. - Created
fastlane/Fastfile, which stores your deployment pipelines.
The setup automatically detects, which tools you're using (e.g. deliver, CocoaPods, xctool).
Before running fastlane, make sure, all tools are correctly set up.
For example, try running the following (depending on what you plan on using):
All those tools have detailed instructions on how to set them up. It's easier to set them up now, than later.
If you want to use snapshot, please follow this step, to authorize snapshot running using fastlane.
First, think about what different builds you'll need. Some ideas:
- New App Store releases
- Beta Builds for TestFlight or HockeyApp
- Only testing (unit and integration tests)
- In House distribution
Open the fastlane/Fastfile in your preferred text editor and change the syntax highlighting to Ruby.
Depending on your existing setup, it looks similar to this (I removed some lines):
before_all do
# increment_build_number
cocoapods
xctool "test"
end
lane :test do
snapshot
end
lane :beta do
sigh
gym
pilot
# sh "your_script.sh"
end
lane :deploy do
snapshot
sigh
gym
deliver(force: true)
# frameit
end
lane :inhouse do
# insert your code here
end
after_all do |lane|
# This block is called, only if the executed lane was successful
end
error do |lane, exception|
# Something bad happened
endYou can already try running it, put a line (say "It works") to the :inhouse lane and run
fastlane inhouse
You should hear your computer speaking to you, which is great!
A list of available actions can be found in the Actions documentation.
Automating the deployment process is a great next step. You should use increment_build_number when you want to upload builds to iTunes Connect (Activate incrementing build numbers).
sh "./script.sh"
This will execute your existing build script. Everything inside the " will be executed in the shell.
If you want a fancy command (like snapshot has), you can build your own extension very easily using fastlane new_action.
See how Wikipedia, Product Hunt and MindNode use fastlane to automate their iOS submission process.
For all those projects you get all required configuration files, which help you get a sense of how you can use fastlane.
Also, check out the Actions documentation to see a list of available integrations and options.
If something is unclear or you need help, open an issue.