How to build applications using Fastlane

Alina Semenukha
LITSLINK
Published in
3 min readJan 13, 2023

Preparation

First of all, you will need to have Brew, Ruby, and Fastlane on your machine, follow those steps if you haven’t yet:

Local Machine preparation

Install Brew:

Install Ruby and Fastlane by the following commands:

  • Ruby: brew install ruby
  • Fastlane: brew install fastlane

Configure Stores

Before you can publish your application build, you will need to set up stores to provide a build that will be published to the beta or even to production.

AppStore & PlayStore
  • Make sure that both projects in (AppStore Connect) and (Google Play Console) for every environment are created and configured.
  • Create a repository for iOS Certificates and Provision Profiles.

Project

  • Create file named Gemfile in the root of your project
  • Add needed gems

Android settings

. After you have created apps in google play console for every of your environment, you need to fill in all required information. With out this information you can not upload build. This is list of information you need to fill in:

Android prod & stage info needed:

  1. App name
  2. Short description
  3. Full description
  4. App icon
  5. Feature graphic
  6. Phone screenshots
  7. Countries anabled
  8. Terms & conditions link

IOS settings

Configure Fastlane

  • Create a folder fastlane in the project root with a single file Fastfile then add these lines to it:
  • Create env files for every environment at the root of your project. For example .env.prod etc.
  • Put variables to env files to connect App Store API Key, checkout certificates and fill in all information, like here:
  • Run command bundle exec falstlane ios build_and_testflight --env prod to generate certificates and provisions for a production build.
  • To continue with IOS and Android, go to Fastfile in root of your project and update it
  • and update your env file
  • Of course, you may want to inform your team that new release is come out. To do that you can integrate slack connection. All you have to do are:
  • Add new section to your .env files
  • Add new lane to your Fastfile (for example slack_connect ) and call it in your build_and_testflight and build_and_playmarket lane after upload_to_testflight() and upload_to_play_store() .
  • And if you want to handle errors and get information about them in slack, just add on_error def to your Fastfile and use in on catch error
  • And call it right after build_and_testflight and build_and_playmarket lanes.
error do |lane, exception|
on_error(exception)
end
  • That is it!

--

--