Integrating Fastlane into Bitrise
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.
- Bitrise has an automated Step, called Fastlane Match for the popular fastlane match tool, which takes care of code signing your project by cloning your private certificate/profile repository and registering the certificates and profiles in the keychain.
- On Bitrise you can run separate lanes for separate branches automatically. For example, you can run a lane for every code push onto the master branch to update screenshots and metadata on the App Store and to release the distribution version. You can run a separate lane for the develop branch to run your automated tests and deploy your test releases for your QA team. You can simply clone the Workflow multiple times, specify the lane to run for the given Workflow in a Workflow Specific Environment Variable, and use the Triggers feature to define which Workflow should be selected for this branch, tag or pull request.
Before you start:
- Note that two-factor authentication (2FA) 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
Gemfileexists in your
work_dirdirectory, fastlane will be used by calling
Fastfileis your configuration file that can be run with fastlane. Make sure you have it inside your
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!
- 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.
- 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.
- Click the Fastlane Step to fill out the required fields.
- Add your lane in the fastlane lane input.
- 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
./here/is/my/fastlane/Fastfile, then the
Fastfile's directory is
./here/is/my/fastlane, so the Working Directory should be
- The Should update fastlane gem before run? option will be skipped if you have a Gemfile in the
work_dirdirectory. If you don't have a Gemfile and this option is enabled, then the Step tries to use and run the latest fastlane version.
- Set the Enable verbose logging? to
yesif you wish to get more detailed logs on your failed builds.
- 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 ->
- Carthage ->
- Android dependencies
That’s it! Start running your build so that Bitrise can run your lane.