Let’s be honest: manually building an IPA or APK, managing signing certificates, and uploading to TestFlight or the Google Play Console is the least exciting part of Flutter development. In my experience, this manual process is where most ‘human errors’ happen—forgetting to bump a version number or using the wrong build configuration.

That’s why I switched to Codemagic. If you’re looking for a codemagic flutter tutorial that skips the fluff and gets you to a production-ready pipeline, you’re in the right place. Codemagic is purpose-built for Flutter, meaning it handles the macOS environment requirements for iOS builds without you needing to maintain your own Mac mini in a closet.

Prerequisites

Before we dive into the automation, make sure you have the following ready:

Step 1: Connecting Your Repository

First, log into Codemagic and click on ‘Add Application’. I recommend connecting your Git provider directly via OAuth. This allows Codemagic to trigger builds automatically whenever you push code to a specific branch.

Once connected, select your Flutter project from the list. Codemagic will automatically detect that it’s a Flutter app and suggest the appropriate build presets. As shown in the image below, you’ll see the initial setup screen where you can choose between the Workflow Editor (UI-based) and the codemagic.yaml file (code-based).

Codemagic application setup screen showing the choice between Workflow Editor and codemagic.yaml
Codemagic application setup screen showing the choice between Workflow Editor and codemagic.yaml

Step 2: Configuring the Build Workflow

While the UI editor is intuitive, I always recommend using the codemagic.yaml file. Why? Because your CI/CD configuration should be version-controlled just like your code. If you change your build steps, you want a git history of those changes.

Create a codemagic.yaml file in your project root. Here is a production-ready starter template I use for most of my projects:

workflows:
  stable-build:
    name: Stable Build
    instance_type: mac_mini_m1
    environment:
      groups:
        - app_secrets
      vars:
        FLUTTER_BUILD_NUMBER: $	ext{BUILD_NUMBER}$
    scripts:
      - name: Install dependencies
        script: flutter packages pub get
      - name: Run tests
        script: flutter test
      - name: Build iOS
        script: flutter build ios --release --no-codesign
      - name: Build Android
        script: flutter build apk --release
    artifacts:
      - build/ios/iphoneos/*.ipa
      - build/app/outputs/flutter-apk/*.apk

In this configuration, I’ve specified mac_mini_m1 because it significantly reduces build times compared to Intel instances. If you’re finding your builds are still too slow, you might want to look into how to speed up flutter build times in CI using caching strategies.

Step 3: Managing Code Signing (The Hard Part)

Code signing is usually the biggest hurdle in any codemagic flutter tutorial. For iOS, you need to upload your Distribution Certificate (.p12) and Provisioning Profile to the Codemagic ‘Environment Variables’ section.

For Android, upload your upload-keystore.jks file and the corresponding aliases and passwords. This ensures that every build generated by the CI is signed and ready for the store.

Step 4: Automated Deployment

Now that the build is working, let’s automate the delivery. You can add a publishing step to your yaml file to push the build to TestFlight or Google Play Beta automatically.

Add this to your scripts section:

      - name: Publish to App Store Connect
        script: |
          app-store-connect upload-app --app-id "YOUR_APP_ID" --ipa "build/ios/iphoneos/*.ipa"

If you’re undecided between different CI tools, I’ve written a detailed Bitrise vs Codemagic comparison to help you choose based on your team size and budget.

Pro Tips for Codemagic Power Users

Troubleshooting Common Issues

Error: CocoaPods not installed or outdated
This usually happens if your yaml file doesn’t specify the correct macOS version. Ensure you are using a recent image that comes pre-installed with the necessary Flutter SDK and CocoaPods versions.

Error: Provisioning profile not found
Double-check that the Bundle ID in your Info.plist exactly matches the one in the provisioning profile you uploaded to Codemagic.

What’s Next?

Now that your pipeline is automated, you can focus on what actually matters: building features. I recommend exploring Fastlane integration with Codemagic if you need even more granular control over your release metadata and screenshots.