Search code examples
iosfluttergithub-actionsfastlane

How to Set Up Fastlane for iOS Builds with GitHub Actions?


I’m working on automating the build and deployment process for my iOS app using Fastlane and GitHub Actions. The goal is to build and distribute the app to TestFlight as part of a CI/CD pipeline. I’ve set up a GitHub Action workflow, but I’m running into some issues during the Fastlane setup for iOS.

Here’s what I’ve done so far:

Created a Fastfile with lanes to handle build and upload to TestFlight. Configured the required secrets in GitHub (e.g., APP_STORE_CONNECT_API_KEY, MATCH_PASSWORD, etc.). Set up Match for handling code signing certificates. Here is my GitHub Actions workflow:

name: iOS CI/CD

on:
push:
 branches:
  - main

jobs:
 build:
 runs-on: macos-latest
 steps:
  - name: Checkout code
    uses: actions/checkout@v4
  
  - name: Install dependencies
    run: bundle install

  - name: Install CocoaPods
    run: bundle exec pod install
  
  - name: Run Fastlane
    run: bundle exec fastlane beta
    env:
      APP_STORE_CONNECT_API_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY }}
      MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}

I’m encountering an issue where the Fastlane build process fails due to a code signing issue on GitHub Actions. The error message is:

Error: "No profiles for 'com.example.app' were found"

Things I’ve tried:

  • Ensured that my Match repository contains the latest provisioning profiles and certificates.
  • Verified that the correct APP_STORE_CONNECT_API_KEY and other secrets are being passed.

Question: What could be causing this issue with code signing, and how can I properly configure Fastlane with GitHub Actions to build and deploy my iOS app to TestFlight? Any tips or steps to debug the code signing process in GitHub Actions?


Solution

  • For Managing ios provisioning profiles & certificates via fastlane match Reset and Revoke all the existing profiles (Only run this when you've updated your provisioning profiles or certificates)

    cd ios/
    fastlane match nuke development
    fastlane match nuke appstore
    

    Install latest development profiles and certificates

    fastlane match development
    

    Install latest distribution profiles and certificates

    fastlane match appstore