Description
Hey Shorebird team! π
First of all, let me express my appreciation for your amazing work on Shorebird π! We're all super excited that code push is finally possible on Flutter! π₯³
I wanted to share a solution I found for using Shorebird with the Codemagic Workflow Editor. As per your documentation, it is mentioned that Codemagic Workflow Editor doesn't support changing the build command, which is required for using Shorebird. I came up with a workaround that allows me to override the default flutter build command with Shorebird's command. I have tested this, and it works successfully on Codemagic.
Here's the setup π:
- Create a bash script (let's call it
setup_shorebird.sh
) with the following content:
#!/bin/bash
# π Install Shorebird
curl --proto '=https' --tlsv1.2 https://raw.githubusercontent.com/shorebirdtech/install/main/install.sh -sSf | bash
echo PATH="/Users/builder/.shorebird/bin:$PATH" >> $CM_ENV
export SHOREBIRD_TOKEN="$SHOREBIRD_TOKEN"
# π οΈ Override the flutter command
cat > flutter_override.sh << 'EOF'
#!/bin/bash
# π§ Check if the first argument is "build"
if [ "$1" == "build" ]; then
# π― Run the modified command
exec shorebird release android --force -- --dart-define=ENVIRONMENT_TYPE=production
else
# π Run the original command with the original arguments
exec flutter "$@"
fi
EOF
# π Make the script executable
chmod +x flutter_override.sh
# π Move the script to /usr/local/bin
sudo mv flutter_override.sh /usr/local/bin/flutter
# π Print a success message
echo "Flutter override script has been installed successfully."
This script downloads and sets up Shorebird, then overrides the default flutter build command.
- In the Codemagic Workflow Editor, add the
setup_shorebird.sh
script to the "Pre-build script" section.

- Add the
SHOREBIRD_TOKEN
environment variable in the "Environment variables" section of the Codemagic Workflow Editor.

And voilΓ ! π©β¨ After completing these steps, the Codemagic build process should use Shorebird's command instead of the default flutter build
.
Please note that I'm using the
shorebird release android --force -- --dart-define=ENVIRONMENT_TYPE=production
command to define environment variables. You can customize this as you wish or even make the script super-dynamic to accept any configuration set up in the workflow editor. π
I hope this workaround helps others who are looking to use Shorebird with Codemagic Workflow Editor π.
Once again, thank you for your fantastic work on Shorebird π!