flutter ci cd with github action and firebase app distribution

370 Views Asked by At

im new with ci cd so im trying to distribute my flutter project via github action im following this youtube link https://www.youtube.com/watch?v=bMbJdZOWl2A it kinda work, but the version of app in firebase is not like with the tag i pushed on my repo and i ask chatGpt to fix this and also correct the release note from tag to match with release note in firebase, but it didn't work this is my main.yml

name: Music Metric

on:
  push:
    tags:
      - '*'

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-java@v2
        with:
          distribution: "zulu"
          java-version: "11"
      - name: Decode google-services.json
        env: 
            GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
        run: echo "$GOOGLE_SERVICES_JSON" > android/app/google-services.json
      - name: Decode firebase_option
        env:
          firebase_options_dart: ${{secrets.FIREBASE_OPTION}}
        run : echo "$firebase_options_dart" > app/lib/firebase_options.dart

      - uses: subosito/flutter-action@v2
        with:
          channel: "stable"
      - run: dart pub global activate melos
      - run: melos bootstrap
      - run: melos gen-strings
      - run: flutter pub get
      - run: melos build-resources
      - run: cd app
      - run: cd lib
      - run: flutter pub get
      - run: flutter clean
      - run: flutter build apk app/lib/main.dart
      - uses: actions/upload-artifact@v1
        with:
          name: release-apk
          path: build/app/outputs/apk/release/app-release.apk

      - name: Extract Version from Tag
        id: extract_version
        run: echo "::set-output name=version::$(echo ${{ github.ref }} | sed -n 's/refs\/tags\/v//p')"

      - name: Fetch Tag Message
        run: |
          git show --format="%m" ${{ steps.extract_version.outputs.tag }}
        id: get_tag_message

      - name: Upload Artifact to Firebase App Distribution
        uses: wzieba/Firebase-Distribution-Github-Action@v1
        with:
          appId: ${{ secrets.APPID }}
          token: ${{ secrets.TOKEN }}
          groups: pre-tester
          file: build/app/outputs/apk/release/app-release.apk
          releaseNotes: "Release for ${{ github.ref }}\n\n${{ steps.get_tag_message.outputs.tag-message }}"
          releaseNotesFile: ''
          appRelease: ${{ steps.extract_version.outputs.version }}

eg: i push my new tag v1.0.7 with release note is "1" image tag

and in firebase it show this enter image description here

i want in firebase it show like 1.0.7 and release note is 1 how can i resolve this

1

There are 1 best solutions below

1
On

Try replacing your ${{ steps.extract_version.outputs.tag }} by ${{ steps.extract_version.outputs.version }} and also, replace your ${{ github.ref }} by ${{ github.ref_name }}