Mobile Applications

Flutter Mobile apps using CI/CD Implementation for Automatic Build process to Firebase App Distribution

Jagadeesh Gumpena - Mobile Application Developer
April 19, 2024

Introduction: 

In today's fast-paced mobile app development landscape, Continuous Integration and Continuous Deployment (CI/CD). These methodologies enhance development efficiency and ensure high-quality app delivery.   

 

Understanding CI/CD: 

Importance of automation in modern app development. 

Facilitating faster and reliable software delivery. 

Setting Up CI/CD for Flutter Apps: 

Configuring pipelines for building, testing, and deploying Flutter Apps. 

Building CI/CD Pipelines: 

Creating build stages. 

Implementing automated testing. 

Handling dependencies and environment configuration. 

Automated Testing Strategies for Flutter: 

Writing effective unit tests and Conducting integration tests. 

Version Control and Code Quality: 

Utilizing version control systems. 

Enforcing code quality standards. 

Integrating code review processes. 

Continuous Deployment Strategies: 

Implementing automated deployment pipelines. 

Monitoring and logging strategies. 

Conclusion: 

CI/CD improves development processes, enhances collaboration, and delivers high-quality mobile apps with speed and reliability. 

name: Build & Release 

  

on: 

  pull_request: 

    branches: 

      - dev 

      - qa 

  push: 

    branches: 

      - dev 

      - qa 

  

jobs: 

  build: 

    name: Build & Release 

    runs-on: ubuntu-latest 

  

    steps: 

      #1 Checkout repository 

      - name: Checkout Repository 

        uses: actions/checkout@v3 

  

      #2 setup java 

      - name: Set Up Java 

        uses: actions/setup-java@v3.12.0 

        with: 

          distribution: 'oracle' 

          java-version: '17' 

  

      #3 setup Flutter 

      - name: Set Up Flutter 

        uses: subosito/flutter-action@v2 

        with: 

          flutter-version: '3.13.9' 

          channel: 'stable' 

  

      #4 install dependencies 

      - name: Install Dependencies 

        run: flutter pub get 

  

      #5 build apk 

      - name: Build APK 

        run: flutter build apk –release 

 

      #6 build aab 

      - name: Build appBundle 

        run: flutter build appbundle 

  

      #7 upload artifacts 

      - name: Upload Artifacts 

        uses: actions/upload-artifact@v2 

        with: 

          name: Releases 

          path: | 

            build/app/outputs/flutter-apk/app-release.apk 

            build/app/outputs/bundle/release/app-release.aab 

  

      #8 create release with those builds 

      - name: Create Release 

        uses: ncipollo/release-action@v1 

        with: 

          artifacts: "build/app/outputs/flutter-apk/app-release.apk,build/app/outputs/bundle/release/app-release.aab,build/ios_build.tar.gz" 

          tag: v1.0.${{ github.run_number }} 

          token: ${{ secrets.secret_token }} 

  

      #9 Deploy to Firebase App Distribution 

      - name: Upload artifact to Firebase App Distribution 

        uses: wzieba/Firebase-Distribution-Github-Action@v1 

        with: 

          appId: ${{secrets.FIREBASE_APP_ID}} 

          serviceCredentialsFileContent: ${{secrets.CREDENTIAL_FILE_CONTENT}} 

          groups: sdaqa 

          file: build/app/outputs/flutter-apk/app-release.apk 

Jagadeesh Gumpena - Mobile Application Developer
April 19, 2024