Fastlane
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”Follow the setup instructions on the fastlane website to install fastlane (ios, android).
Using fastlane on CI
Section titled “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.
A working example of this setup can be found in our fastlane_demo repository.
To get started, follow this guide to set up fastlane with certificate management, code signing, and submitting to the App Store/TestFlight.
You will notice that our demo app’s
Fastfile
has both deploy
and release_shorebird
lanes. The deploy
lane comes from
the guide linked to above. The release_shorebird
lane is our 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”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
.
Using fastlane locally
Section titled “Using fastlane locally”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.
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, we will choose to manually add lanes
to the Fastfile
.
Use the Shorebird plugin
Section titled “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”Open the Fastfile
in the fastlane
directory and add the following lane:
lane :release_shorebird do shorebird_release(platform: "ios") upload_to_testflightend
To run this, execute the following command:
bundle exec fastlane release_shorebird
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”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")