The Ops Community ⚙️

Marie
Marie

Posted on

To automate the deployment of your Flutter iOS app using GitHub Actions and Codemagic CLI,

To automate the deployment of your Flutter iOS app using GitHub Actions and Codemagic CLI, follow these steps to set up a smooth CI/CD pipeline—like automating content updates for a site like Animesuge.
Step 1: Set Up Codemagic CLI
First, install Codemagic CLI Tools (codemagic.yaml configuration) in your Flutter project. Codemagic CLI will handle builds, signing, and deployments directly from the command line, which is essential for automation.

Visit Codemagic's CLI tools page and set up authentication tokens.
Configure codemagic.yaml in your project root with your specific iOS build configuration.
Step 2: Create GitHub Action Workflow
In your GitHub repository, create a workflow file under .github/workflows/ci_cd.yml. Here’s a basic example:
name: iOS Deployment
on:
push:
branches:
- main

jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2

  - name: Install Flutter
    uses: subosito/flutter-action@v2
    with:
      flutter-version: 'latest'

  - name: Install Codemagic CLI
    run: brew install codemagic

  - name: Build iOS App
    run: codemagic build --ios

  - name: Deploy to App Store
    run: codemagic publish
    env:
      APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }}
      APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_ISSUER_ID }}
Enter fullscreen mode Exit fullscreen mode

Step 3: Set Up Secrets
In GitHub, go to Settings > Secrets for your repository. Add the necessary secrets, like APP_STORE_CONNECT_API_KEY and APP_STORE_CONNECT_ISSUER_ID, to authorize the Codemagic CLI.

Step 4: Trigger the Action
Every time you push a change to the main branch, GitHub Actions will automatically start a new build using Codemagic CLI. Once successful, your iOS app will be deployed to the App Store.

Top comments (0)