---
title: "Fastlane"
description: "Using fastlane with Shorebird"
---

Fastlane is a popular tool for automating the build and release process for iOS and Android apps. Shorebird can be integrated with fastlane to automate releasing and patching.

## Installation

[Section titled “Installation”](#installation)

Follow the setup instructions on the fastlane website to install fastlane ([ios](https://docs.fastlane.tools/getting-started/ios/setup/), [android](https://docs.fastlane.tools/getting-started/android/setup/)).

## Using Fastlane on CI

[Section titled “Using Fastlane on CI”](#using-fastlane-on-ci)

This section assumes that you are using fastlane on CI to release your app. If you are running fastlane locally (on your development machine), you can skip to the [Using fastlane locally](#using-fastlane-locally).

A working example of this setup can be found in the [fastlane\_demo](https://github.com/shorebirdtech/fastlane_demo) repository.

To get started, follow [this guide](https://medium.com/revelo-tech/setting-up-automatic-ios-release-with-fastlane-and-match-on-ci-cd-server-16c3f1d79bc5) to set up fastlane with certificate management, code signing, and submitting to the App Store/TestFlight.

Notice that the demo app’s [`Fastfile`](https://github.com/shorebirdtech/fastlane_demo/blob/main/ios/fastlane/Fastfile) has both `deploy` and `release_shorebird` lanes. The `deploy` lane comes from the guide linked to above. The `release_shorebird` lane is a custom lane that uses the `shorebird_release` action **in place of** `build_app` to build an ipa, create a Shorebird release, and submit it to the App Store/TestFlight.

Note that this change from `build_app` to `release_shorebird` is the only change needed to add Shorebird to your fastlane workflow.

### Patching

[Section titled “Patching”](#patching)

To patch your app, you can use the `shorebird_patch` action. You can see an example of this in the `patch_shorebird` lane in the [`Fastfile`](https://github.com/shorebirdtech/fastlane_demo/blob/main/ios/fastlane/Fastfile#L92-L98).

## Using Fastlane locally

[Section titled “Using Fastlane locally”](#using-fastlane-locally)

### Setup

[Section titled “Setup”](#setup)

Follow this section if you have Shorebird installed on the machine that will be running fastlane. This section assumes that you have Shorebird installed on the machine that will be running the fastlane commands. If you have not already installed Shorebird, you can do so by following the [Getting Started instructions](/getting-started).

If you are not already using fastlane with your project, navigate to your app’s `ios` directory in your project and run `fastlane init`. You will be prompted to answer several questions. For this guide, choose to manually add lanes to the `Fastfile`.

### Use the Shorebird plugin

[Section titled “Use the Shorebird plugin”](#use-the-shorebird-plugin)

Run the following command to install the `shorebird` fastlane plugin, which exposes the `shorebird_release` and `shorebird_patch` actions.

```
bundle exec fastlane add_plugin shorebird
```

### Update Fastfile to release

[Section titled “Update Fastfile to release”](#update-fastfile-to-release)

Open the `Fastfile` in the `fastlane` directory and add the following lane:

```
lane :release_shorebird do
  shorebird_release(platform: "ios")
  upload_to_testflight
end
```

To run this, execute the following command:

```
bundle exec fastlane release_shorebird
```

Note

To upload to TestFlight, you will need to create an Apple app-specific password. You can do this at <https://appleid.apple.com/account/manage>. Once you have created the password, create a `.env` file in your fastlane directory and add `FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=your_password_here`.

If you would like to provide additional arguments to the release command, you can do so using the `args` parameter. For example:

```
shorebird_release(platform: "ios", args: "--no-codesign -- --build-name=1.0.0")
```

### Update Fastfile to patch

[Section titled “Update Fastfile to patch”](#update-fastfile-to-patch)

Open the `Fastfile` in the `fastlane` directory and add the following lane:

```
lane :patch_shorebird do
  shorebird_patch(platform: "ios")
end
```

This will patch the iOS release with the version number detected in the compiled app and patch the release with that version.

As with `shorebird_release`, you can provide additional arguments to the patch command using the `args` parameter.

```
shorebird_patch(platform: "ios", args: "--allow-native-diffs -- --build-name=1.0.0")
```
