Github workflow cache path with fastlane and flutter

Viewed 668

I am trying to optimise my cicd deployment workflow for android and ios with cache but I have a problem with the cache path. When not caching the workflow works well but when caching, the fastlane action doesn't find flutter or pods and I get errors like "error: /Users/runner/work/xxx/xxx/ios/Flutter/Release.xcconfig:1: could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig' in search paths (in target 'Runner' from project 'Runner')"

name: Deploy staging

on:
  workflow_dispatch:
    inputs:
      lane:
        description: "Staging lane to use : alpha or beta"
        required: true
        default: "alpha"

jobs:
  deploy-to-ios:
    runs-on: macos-latest
    timeout-minutes: 30

    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Setup Flutter Cache
        id: cache-flutter
        uses: actions/cache@v2
        with:
          path: /Users/runner/hostedtoolcache/flutter
          key: ${{ runner.os }}-flutter
          restore-keys: |
            ${{ runner.os }}-flutter-

      - name: Setup Flutter
        uses: subosito/flutter-action@v1
        if: steps.cache-flutter.outputs.cache-hit != 'true'
        with:
          channel: "stable"

      - name: Setup Pods Cache
        id: cache-pods
        uses: actions/cache@v2
        with:
          path: Pods
          key: ${{ runner.os }}-pods-${{ hashFiles('ios/Podfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-pods-

      - name: Setup Pods
        if: steps.cache-pods.outputs.cache-hit != 'true'
        run: |
          cd ios/
          flutter pub get
          pod install

      # Setup Ruby, Bundler, and Gemfile dependencies
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: "2.7.4"
          bundler-cache: true
          working-directory: ios

      - name: Setup Fastlane Cache
        id: cache-fastlane
        uses: actions/cache@v2
        with:
          path: ./vendor/bundle
          key: ${{ runner.os }}-fastlane-${{ hashFiles('ios/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-fastlane-

      - name: Setup Fastlane
        if: steps.cache-fastlane.outputs.cache-hit != 'true'
        run: gem install fastlane

      - name: Build and deploy with Fastlane 
        run: bundle exec fastlane ${{ github.event.inputs.lane || 'beta' }}
        env:
          MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
          MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
          APP_STORE_CONNECT_API_KEY_KEY_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY_ID }}
          APP_STORE_CONNECT_API_KEY_ISSUER_ID: ${{ secrets.APP_STORE_CONNECT_API_KEY_ISSUER_ID }}
          APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }}
        working-directory: ios

Any idea how to find the path used in fastlane for flutter and pods and cache the files there so they are found ?

0 Answers
Related