Home > Enterprise >  When uploading apk with the Run wzieba/[email protected] I get the followin
When uploading apk with the Run wzieba/[email protected] I get the followin

Time:11-02

I am trying to upload an apk to firebase using github action. I have commented out the code analysis and tests to make the action run faster so as to try and resolve the issue. I have also tried to upload an app bundle, I get the same response. Here is the github action configuration.

name: Deploy app bundle to firebase

on:
  push:
    branches:
      - dev

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-java@v1
        with:
          java-version: '12.x'
      - uses: subosito/flutter-action@v1 # Setup flutter environment
        with:
          flutter-version: '2.5.0'

      - run: flutter pub get
      - run: flutter pub run build_runner build --delete-conflicting-outputs
      - name: Create env file
        run: |
          cat << EOF > .env
          STAGING_API_BASE_URL="${{ secrets.STAGING_API_BASE_URL }}"
          PROD_API_BASE_URL="${{ secrets.PROD_API_BASE_URL }}"
          BASE_PATH="${{ secrets.BASE_PATH }}"
          EOF
      #      - run: flutter format --set-exit-if-changed #       - run: flutter format --set-exit-if-changed .
      #- run: flutter analyze # Analyze the project's Dart code. This causes job to exit
      #- name: Run flutter analyze
      #  run: |
      #    chmod  x ./flutter_analyze.sh
      #    ./flutter_analyze.sh
      #- run: flutter test # Run Flutter unit tests for the current project.
      - name: Build Gradle
        run: flutter build apk --debug
      - uses: actions/checkout@v2 #This uploads artifacts from your workflow
        with:
          name: debug-apk
          path: build/app/outputs/flutter-apk/app-debug.apk
      - run: ls build/app/outputs/flutter-apk
      - name: Upload artifact to Firebase App Distribution
        uses: wzieba/[email protected]
        with:
          appId: ${{secrets.FIREBASE_APP_ID}}
          token: ${{secrets.FIREBASE_TOKEN}}
          groups: testers
          file: build/app/outputs/flutter-apk/app-debug.apk  

When I run the workflow I get the following error: enter image description here

CodePudding user response:

You can use this script to find your built apk path:

run: |
  echo "Find build artifacts"

  apkPath=$(find app -name "*.apk" | head -1)
  echo "Found apk at $apkPath"
  
  if [[ -z ${apkPath} ]]
  then
      echo "No apks were found, skip publishing to App Distribution"
  else
      echo "Publishing $apkPath to App Center"
      #publish your apk by using $apkPath
  fi

it scans all agent files and finds apk file.

CodePudding user response:

I had made a mistake on this line

- uses: actions/checkout@v2 #This uploads artifacts from your workflow

The comment is correct but the action is wrong. I should have used actions/upload-artifact https://github.com/wzieba/Firebase-Distribution-Github-Action/issues/51

  • Related