Deployment in Testflight through Fastlane and Github Actions fails

1.4k views Asked by At

I followed this tutorial in order to setup a Github Action for automating building and deployment of iOS Apps through Testflight. If I use testlane locally, everything works as expected and Application is sent to TestFlight. But on Github Actions, the building succeeds but when I need to upload the app to Appstore Connect, I get the error:

error: No profile for team 'XXX' matching 'match AppStore com.XXX.XXX' found: Xcode couldn't find any provisioning profiles matching 'XXX/match AppStore com.XXX.XXX'

I have added correctly every secret that is needed but for some reason fastlane match cannot find my Provisioning Profiles and my signing certificate. Any help would be greatly appreciated. I add my yaml configuration below:

name: Build Flutter for iOS
# This workflow is triggered on pushes to the repository.
on: [push]
  # workflow_dispatch:

env:
    flutter_version: '1.22.1'
    java_version: '12.x'
    gcloud_version: '290.0.1'

jobs:
  build:
    name: Build 
    runs-on: macos-latest
    steps:
      # ===== APPSTORE SIGNING BUILD====#
      - uses: actions/checkout@v2

      - name: Select Xcode version
        run: sudo xcode-select -s '/Applications/Xcode_11.3.app/Contents/Developer'
      - name: Bundle install
        run: cd ./ios && bundle install
      # ==== SETUP FLUTTER
      - name: Setup JDK
        uses: actions/setup-java@v1
        with:
          java-version: ${{ env.java_version }}
      # https://github.com/subosito/flutter-action/issues/16
      - uses: actions/cache@v2
        with:
          path: /opt/hostedtoolcache/flutter
          key: ${{ runner.OS }}-flutter-install-cache-${{ env.flutter_version }}
      - uses: subosito/[email protected]
        with:
          flutter-version: ${{ env.flutter_version }}
          channel: 'stable'
      - name: Install tools
        run: |
            flutter pub get
            cd ./ios && pod install
      - name: Setup SSH Keys and known_hosts for fastlane match
        run: |
            SSH_PATH="$HOME/.ssh"
            mkdir -p "$SSH_PATH"
            touch "$SSH_PATH/known_hosts"
            echo "$PRIVATE_KEY" > "$SSH_PATH/id_rsa"
            chmod 700 "$SSH_PATH"
            ssh-keyscan github.com >> ~/.ssh/known_hosts
            chmod 600 "$SSH_PATH/known_hosts"
            chmod 600 "$SSH_PATH/id_rsa"
            eval $(ssh-agent)
            ssh-add "$SSH_PATH/id_rsa"
        env:
          PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
      - name: Deploy to TestFlight
        run: |
            cd ./ios && bundle exec fastlane beta
        env:
            TEAM_ID: ${{ secrets.TEAM_ID }}
            ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
            FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
            FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
            FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
            FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
            MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
            MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
            MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}

And this is my fastfile:

 platform :ios do
  desc "Push a new beta build to TestFlight"
  lane :beta do
    build_app(workspace: "Runner.xcworkspace", scheme: "Runner")
    upload_to_testflight
    if is_ci
        create_keychain(
          name: ENV['MATCH_KEYCHAIN_NAME'],
          password: ENV["MATCH_KEYCHAIN_PASSWORD"],
          default_keychain: true,
          unlock: true,
          timeout: 3600,
          lock_when_sleeps: false
        )
    end
    match(
        type: "appstore",
        readonly: is_ci,
        keychain_name: ENV['MATCH_KEYCHAIN_NAME'],
        keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"],
    )
    build_app(
      workspace: "Runner.xcworkspace",
      scheme: "Runner",
      export_method: "development"
    )
    upload_to_testflight
  end
end
1

There are 1 answers

0
Prince Kelvin On

ensure if type: "appstore" then export_method: "app-store"

eg:

   match(
        type: "appstore",
        readonly: is_ci,
        keychain_name: ENV['MATCH_KEYCHAIN_NAME'],
        keychain_password: ENV["MATCH_KEYCHAIN_PASSWORD"],
    )
    build_app(
      workspace: "Runner.xcworkspace",
      scheme: "Runner",
      export_method: "app-store"
    )