GitHub

fastlane tools integration

Bitrise is a hosted CI/CD solution where you can run your fastlane lane with the same commands you would use locally. Bitrise’s automated Steps provide extra functionality to your lane and speed up your builds.

Here is how you can benefit from integrating fastlane into Bitrise.

Before you start:

Note that two-factor authentication is mandatory for all Apple Developer Portal accounts. If, during your build, Bitrise needs to access your Apple Developer Portal account, it will have to go through 2FA. This applies even if you use fastlane. To make this work, connect your Apple Developer Account to Bitrise. This allows Bitrise to reuse your authentication sessions for 30 days, so you do not have to manually go through 2FA on every single occasion.

If a Gemfile exists in your work_dir directory, fastlane will be used by calling bundle install then bundle exec.

Fastfile is your configuration file that can be run with fastlane. Make sure you have it inside your ./fastlane directory.

Setting up fastlane on Bitrise

Running fastlane on Bitrise is as simple as adding one Step to your Workflow and setting some options. Let’s see how!

  1. Add the Fastlane Step to your Workflow by clicking the + sign. Make sure it is inserted right after the Git Clone Step. Since fastlane is pre-installed on all Bitrise’s virtual machines, the Fastlane Step ensures that you can always use the required fastlane version.
  2. To code sign your project, you have a couple of options to choose from. Add one of Bitrise’s code signing Steps to your Workflow such as: Certificate and profile installer, iOS Auto Provision,Fastlane Match. Alternatively, use fastlane match inside your fastlane lane instead of a code signing Step. Make sure you either use the Fastlane Match Step or set up fastlane match in your lane but don’t try to do both.
  3. Click the Fastlane Step to fill out the required fields.
  4. Add your lane in the fastlane lane input.
  5. Use Working directory field if the fastlane directory is not in your repository’s root. The working directory should be the parent directory of your Fastfile’s directory. For example, if the Fastfile path is ./here/is/my/fastlane/Fastfile, then the Fastfile’s directory is ./here/is/my/fastlane, so the Working Directory should be ./here/is/my.
  6. The Should update fastlane gem before run? option will be skipped if you have a Gemfile in the work_dir directory. If you don’t have a Gemfile and this option is enabled, then the Step tries to use and run the latest fastlane version.
  7. Set the Enable verbose logging? to yes if you wish to get more detailed logs on your failed builds.
  8. If the Enable collecting files to be included in build cache is set to yes, the Step adds the following cache items (if they exist):
    • Pods - Podfile.lock
    • Carthage - Cartfile.resolved
    • Android dependencies

That’s it! Start running your build so that Bitrise can run your lane.