Flutter Github Actions Build and Deploy Web to Firebase Hosting, iOS to Testflight, Android to Google Play (fastlane)

name: CI
on:
  push:
    branches:
      - master
  pull_request:
    branches:
      - master
jobs:
  build_web:
    name: Build Flutter (Web)
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: subosito/flutter-action@v1
      with:
          channel: 'dev'
    - run: flutter pub get
    - run: flutter config --enable-web
    - run: flutter build web
    - name: Archive Production Artifact
      uses: actions/upload-artifact@master
      with:
        name: web-build
        path: build/web
  build_ios:
    name: Build Flutter (iOS)
    runs-on: macOS-latest
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-java@v1
      with:
        java-version: '12.x'
    - uses: subosito/flutter-action@v1
      with:
          channel: 'dev'
    - run: flutter pub get
    - run: flutter clean
    - run: flutter build ios --release --no-codesign
    - name: Upload iPA
      uses: actions/upload-artifact@master
      with:
        name: ios-build
        path: build/ios/iphoneos
  build_apk:
    name: Build Flutter (Android)
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-java@v1
      with:
        java-version: '12.x'
    - uses: subosito/flutter-action@v1
      with:
          channel: 'dev'
    - run: flutter pub get
#     - run: flutter build apk --target-platform android-arm,android-arm64 --split-per-abi
#     - run: flutter build appbundle --target-platform android-arm,android-arm64
    - run: flutter build appbundle
    - name: Upload APK
      uses: actions/upload-artifact@master
      with:
        name: apk-build
        path: build/app/outputs/apk/release
  deploy_web:
    name: Deploy Web to Firebase Hosting
    needs: build_web
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repo
        uses: actions/checkout@master
      - name: Download Artifact
        uses: actions/download-artifact@master
        with:
          name: web-build
          path: web-build
      - name: Deploy to Firebase
        uses: w9jds/firebase-action@master
        with:
          args: deploy --only hosting --public web-build
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
          PROJECT_ID: default
#   deploy_ios:
#     name: Deploy iOS Beta
#     needs: [build_ios]
#     runs-on: macOS-latest
#     steps:
#       - uses: actions/checkout@v1
#       - uses: subosito/flutter-action@v1
#         with:
#           channel: 'dev'
#       - run:  mkdir ~/.ssh/ && echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
#       - uses: webfactory/[email protected]
#         with:
#           ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
#       - uses: maierj/[email protected]
#         with:
#           lane: 'beta'
#           subdirectory: 'ios'
#         env:
#           GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#           MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
#   deploy_apk:
#     name: Deploy Android Beta
#     needs: [build_apk]
#     runs-on: ubuntu-latest
#     steps:
#       - uses: actions/checkout@v1
#       - uses: actions/setup-java@v1
#         with:
#           java-version: '12.x'
#       - uses: subosito/flutter-action@v1
#         with:
#           channel: 'dev'
#       - uses: maierj/[email protected]
#         with:
#           lane: 'beta'
#           subdirectory: 'android'
#         env:
#           GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  beta_ios:
    name: Upload iOS Beta to Firebase App Distribution
    needs: [build_ios]
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Download Artifact
      uses: actions/download-artifact@master
      with:
        name: ios-build
    - name: Upload IPA
      uses: wzieba/[email protected]
      with:
        appId: ${{secrets.FIREBASE_IOS_APPID}}
        token: ${{secrets.FIREBASE_TOKEN}}
        group: testers
        file: Runner.ipa
  beta_apk:
    name: Upload Android Beta to Firebase App Distribution
    needs: [build_apk]
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - name: set up JDK 1.8
      uses: actions/setup-java@v1
      with:
        java-version: 1.8
    - name: Download Artifact
      uses: actions/download-artifact@master
      with:
        name: apk-build
    - name: Upload APK
      uses: wzieba/[email protected]
      with:
        appId: ${{secrets.FIREBASE_ANDROID_APPID}}
        token: ${{secrets.FIREBASE_TOKEN}}
        group: testers
        file: app-release.aap
    

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source