Fastlane - Automation and Continuous Delivery for iOS Apps

Preview:

Citation preview

Fastlane - Automation & Continuous Delivery for

iOS AppsSarath C,

Architect, Experion Technologies

@saratArchitect, Experion Technologies

State of iOS Development at Experion Technologies

• We use Swift for all new projects

• We have delivered about 15 iOS projects developed using Swift in past 2 years

• All our developers are trained to work with Swift

• We still use Objective-C — mostly for legacy code base

• Modern tools and workflows to deliver projects

tools & workflows

the best tools are…

something that works well for your team

what’s fastlane?

fastlane lets you define and run your deployment pipelines for different environments

It helps you unify your app’s release process and automate the whole process

fastlane connects all fastlane tools and third party tools, like CocoaPods

lanes

lanes are typically deployment pipelines

and the recipe is yours

tools

upload screenshots, metadata and your app to the App Store using a

single command.

automate taking localized screenshots of your iOS app on

every device

quickly put your screenshots into the right device frames

automatically generate and renew your push notification profiles

because you would rather spend your time building stuff than

fighting provisioning

create new iOS apps on iTunes Connect and Developer Portal using

the command line

automatically create and maintain iOS code signing certificates

the easiest way to run tests of your iOS and Mac app

building your iOS app has never been easier

easily sync your certificates and profiles across your team using

Git

the best way to manage your TestFlight testers and builds from

your terminal

instantly create a simple signup page for TestFlight beta testers

a Ruby library to access the Apple Developer Center and iTunes

Connect

demo

build. test. screenshots. sign. deliver

gem install fastlane

fastlane init

👈

👈

how authentication works?

snapshot init

👈

👈

👈

👈

match

$ match appstore

$ match development

HockeyApp

desc "Deploy a new version to Hockey App" lane :hockey do match(type: "development") gym(scheme: "fastlane-demo") # Build your app - more options available hockey( api_token: API_TOKEN public_identifier: APP_ID, notes: "Changelog", notify: '0', notes:git_branch + ' (Uploaded via fastlane).' ) end

👈

👈👈

running…

stats

TestFlight

lane :appstore do increment_build_number cocoapods scan snapshot sigh deliver sh "./customScript.sh"

slack end

tips

ruby --versionruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

$ xcode-select --install $ brew install rbenv $ rbenv install -l $ rbenv install 2.2.5 $ rbenv install 2.3.1 $ rbenv global 2.3.1

$ vim ~/.zshrc

RBENV_VERSION="system" export PATH="~/.rbenv/shims:/usr/local/bin:/usr/sbin:/usr/bin:/bin:/sbin:~/.rvm/bin" eval "$(rbenv init -)"

.gitignoremake sure you don’t include fastlane

generated files in your repo

gitignore.iopro tip: use it in commandline

frameityou need to download the templates from apple’s website. tool will point you to right place for the first time setup.

app iconsYour app icons needs to be configured

properly to upload to App Store. use utilities like makeappicon.com to

generate required images size.

CI Environment Variables

It’s not a good idea to embed the secret keys and files within the code/repo.

Use environment variables, settings and integration features of CI Server to secure

your data

use private reposthere are several bots pulling out keys and

content from the public github repo. don’t put your projects at risk.

🔐

auto build number increment

to automate the build number increment, you have to set the version in the project’s

build settings

https://developer.apple.com/library/ios/qa/qa1827/_index.html

TestFlight Build# + 1

increment_build_number({ build_number: latest_testflight_build_number + 1 })

change log from commits

# Collects commits since your last tag and returns a concatenation of their subjects and bodies

changelog_from_git_commits

ActionsThis is an ultimate guide to bring best out of your fastlane pipeline. This guide contains documentation on fastlane actions to extend fastlane tools.

github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md

match

A handy utility to securely share your certificates and provision files across the systems. Quite useful when you work with CI servers and multiple machines

where to go from here?

• fastlane.tools/ • github.com/fastlane/fastlane • github.com/fastlane/examples • github.com/fastlane/fastlane/blob/master/fastlane/docs/Actions.md

what’s next?

👍