Dev.to · 4 min read

Automate Flutter Releases with Shorebird + GitHub Actions (Skip App Store Review)

Automate Flutter Releases with Shorebird + GitHub Actions (Skip App Store Review)

A real pain point for mobile apps is waiting days or weeks for App Store and Play Store reviews whenever you need to ship a fix or a small update to users. That exact problem is what we are solving in this article. I’ll show you exactly how to automate your Flutter releases and patches using Shorebird and GitHub Actions, so you can push updates to users in minutes instead of waiting for store review. We are going to create a clean, production-ready CI pipeline for both full releases and instant code-push updates. Prerequisites Before we start, here’s what you need: A Shorebird account and an app already set up with Shorebird Shorebird CLI installed and logged in on your machine A Flutter project that already has Shorebird initialized A GitHub repository Basic understanding of GitHub Actions If you haven’t set up Shorebird in your Flutter app yet, check out my video on YouTube on how to set up Shorebird. This article assumes that’s already done. Authentication Setup The first thing we need is authentication so GitHub Actions can talk to Shorebird. Go to the Shorebird Console → Account → API Keys → Create API Key. Give it a clear name, e.g “GitHub Actions”, choose an expiration, and set the required permissions. Copy the key immediately because you won’t see it again. Now go to your GitHub repository → Settings → Secrets and variables → Actions → New repository secret. Name it exactly: SHOREBIRD_TOKEN Paste the key and save. This token will be available in all your workflows as ${{ secrets.SHOREBIRD_TOKEN }}. That’s the only authentication step you need. Official Shorebird GitHub Actions Shorebird provides three official GitHub Actions that make life much easier: shorebirdtech/setup-shorebird@v1 — installs Shorebird on the runner shorebirdtech/shorebird-release@v1 — creates a release shorebirdtech/shorebird-patch@v1 — creates a patch I strongly recommend using these instead of calling the CLI manually. They’re cleaner and maintained by the Shorebird team. Release Workflow Let’s build the release workflow first. Create a new file in your project: .github/workflows/shorebird-release.yml Here’s the structure: Trigger on version tags: v1.0.0, v1.2.3, etc. or manually trigger the workflow Set the SHOREBIRD_TOKEN as an environment variable Pin your Flutter version (very important) Checkout the code Set up Java for Android (or Xcode signing for iOS) Set up Shorebird with caching Decode your keystore/certificates from secrets Run the official shorebird-release action Upload the APK, AAB, or IPA as artifacts I’ll show both Android and iOS versions. For Android, the key steps are decoding the keystore and creating the key.properties file from secrets. GitHub Secrets You Need to Add for Android Go to GitHub → repo → Settings → Secrets and variables → Actions → New repository secret Secret name - Value ANDROID_KEY_ALIAS - your_key_alias ANDROID_KEY_PASSWORD - your_key_password ANDROID_STORE_PASSWORD - your_store_password ANDROID_KEYSTORE_BASE64 - run `base64 -i ~/path/to/upload.jks | tr -d '\n' | pbcopy` The keystore base64 will be copied to your clipboard; paste it into GitHub Secrets GitHub Secrets You Need to Add for iOS Go to GitHub → repo → Settings → Secrets and variables → Actions → New repository secret Secret name - Value IOS_CERTIFICATE_BASE64 - base64 of your .p12 IOS_CERTIFICATE_PASSWORD - Password you set when exporting the .p12 IOS_PROVISIONING_PROFILE_BASE64 - base64 of com.example.app profile For iOS, you need to import the certificate and provisioning profile into a temporary keychain. # IOS_CERTIFICATE_BASE64 - export your .p12 from Keychain Access first, then: base64 -i ~/path/to/distribution.p12 | tr -d '\n' | pbcopy # IOS_PROVISIONING_PROFILE_BASE64 - download from Apple Developer Portal base64 -i ~/path/to/YourApp_AppStore.mobileprovision | tr -d '\n' | pbcopy You can check out this document on how to create an Apple Distribution Certificate. Once this workflow finishes, you get signed artifacts ready to upload to the stores. This is your normal full release path. name: Shorebird Release on: workflow_dispatch: inputs: platform: description: 'Target platform' required: true default: 'both' type: choice options: - android - ios - both jobs: release_android: name: Release Android if: ${{ github.event.inputs.platform == 'android' || github.event.inputs.platform == 'both' }} runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@v4 - name: Setup Java uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '17' - name: Setup Android Keystore run: | echo "${{ secrets.ANDROID_KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks cat > android/key.properties android/key.properties

This is a summary aggregated from Dev.to. Read the complete article on the original site:

Read full article at Dev.to

More Programming & Dev News