Codemagic recently published
their own guide
on how to integrate with Shorebird.
Codemagic Workflow Integration
This guide will help you integrate Shorebird into your Codemagic Workflow using the Codemagic YAML.
Prerequisites
✅ Shorebird CLI is installed on your machine
✅ You are logged into a Shorebird account.
Refer to the getting started instructions for more information.
Authentication
Most Shorebird functionality, like creating releases and patches, requires being authenticated. In order to authenticate with Shorebird in CI, you will need to generate a CI token.
You will be prompted to go through a similar OAuth Flow as when using shorebird login, however, shorebird login:ci will not store any credentials on your device. Instead, a Shorebird token will be generated for you to use in CI.
The output should look something like:
Next, copy the generated SHOREBIRD_TOKEN and navigate to your Codemagic
secrets via:
Go to “Environment Variables”
Enter SHOREBIRD_TOKEN as variable name
Paste the token into the variable value field
Select or create new group, such as “shorebird”
Ensure “Secure” is checked
We recommend using the variable name SHOREBIRD_TOKEN as it’s the default name
used by the Shorebird CLI. If you choose a different name, you’ll need to set
the SHOREBIRD_TOKEN environment variable in your Codemagic workflow manually.
Codemagic Workflow Editor
Unfortunately, the Codemagic Workflow Editor doesn’t support changing the build
command. As a result, you will need to use the Codemagic YAML
file to integrate Shorebird into your workflow.
Add the group “shorebird” to your environment groups. If you’re using a
different group name, use that instead.
If your target is ios, you need to specify the code signing mechanism. First you need to setup provisional profile and certificate for that. You may find the setup here.
Add a script to your workflow to set up Shorebird. This script will install
Shorebird and add it to your PATH.
Execute Shorebird commands in your workflow.
Full Example
Here’s an example of a complete codemagic.yaml file:
Add the group containing SHOREBIRD_TOKEN to your environment groups (in our
case, the “shorebird” group we created above). Also add a variable named shorebird
with the path to the Shorebird executable.
Add a script to your workflow to set up Shorebird. This script will install
Shorebird.