Firebase 应用程序通过 github 操作使用 fastlane 进行分发?

问题描述 投票:0回答:2

我是

Fastlane
的新手,并在
Firebase
操作上使用
Github
应用程序分发来分发应用程序。

FastLane 文件

default_platform(:android)

platform :android do
 desc "Runs all the tests"
 lane :test do
  gradle(task: "test")
end

desc "Build and submit to Firebase App distribution Internal users"
lane :dev do

firebase_app_distribution(
  app: "some -app -ID",
  groups: "internal-testers",
  release_notes_file: "FirebaseAppDistributionConfig/dev_notes.txt",
)
end
end

Github 操作

name: Distribute

on:
 push:
   branches: [ master ]

jobs:
  distribute:
   runs-on: ubuntu-latest

steps:
  - uses: actions/checkout@v2

  - uses: actions/setup-ruby@v1
    with:
      ruby-version: '2.6'
  
  - name: Install bundle
    run: |
      bundle config path vendor/bundle
      bundle install --jobs 4 --retry 3     

  - name: Create Firebase Service Credentials file
    run: |
      echo "$FIREBASE_CREDENTIALS" > firebase_credentials.json.b64
      base64 -d -i firebase_credentials.json.b64 > firebase_credentials.json
    env:
      FIREBASE_CREDENTIALS: ${{ secrets.FIREBASE_CREDENTIALS }}
      
  - name: Distribute app with 🔥 App Distribution 🚀
    run: bundle exec fastlane dev
    env:
      FIREBASE_APP_ID: ${{ secrets.FIREBASE_APP_ID }}    

每当我提交到主分支时,我都会得到“

Couldn't find binary
”。这是 GitHub 操作终端的截图

我什至将所有

secrets
添加到 GitHub 存储库。但是,如果我运行
bundle exec fastlane dev
。它工作正常,我可以看到新的 APK 上传到 firebase 应用程序分发平台。

有什么提示我在这里做错了什么吗?有没有办法可以看到堆栈跟踪为什么 fastlane 找不到 apk?

android firebase github github-actions fastlane
2个回答
1
投票

您可以使用指定apk或bundle文件绝对路径


desc "Build and submit to Firebase App distribution Internal users"
lane :dev do |options|

firebase_app_distribution(
  app: "some -app -ID",
  groups: "internal-testers",
  release_notes_file: "FirebaseAppDistributionConfig/dev_notes.txt",
  android_artifact_path: "type it here directly or 
                          pass it through terminal>>" options[:buildPath]
)
end

如果您想从终端使用它:

bundle exec fastlane dev buildPath:"must be the full path to the artifact!! something like this>../app/build/outputs/apk/dev/release/app-dev-release.apk"

0
投票

问题是你缺少这个插件 捆绑执行 fastlane add_plugin firebase_app_distribution

这是 Compele 工作流程: 名称: 扑扑

在: 推: 分支:[主要]

工作: 构建:

runs-on: ubuntu-latest

steps:
  - uses: actions/checkout@v2

  - name: Install Ruby
    uses: ruby/setup-ruby@v1
    with:
      ruby-version: '2.7'


  - name: set up JDK 11
    uses: actions/setup-java@v3
    with:
      distribution: 'temurin'
      java-version: '17'
  - uses: subosito/flutter-action@v1
    with:
      channel: 'stable'

  - name: Clean Flutter Dependencies.
    run: flutter clean

  - name: Get Flutter Dependencies.
    run: flutter pub get


  - name: Cache Ruby - Bundler
    uses: actions/cache@v2
    with:
      path: vendor/bundle
      key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
      restore-keys: |
        ${{ runner.os }}-gems-


  - name: Cache Gradle
    uses: actions/cache@v1
    with:
      path: ~/.gradle/caches/
      key: cache-clean-gradle-${{ matrix.os }}-${{ matrix.jdk }}

  - name: Cache Gradle Wrapper
    uses: actions/cache@v1
    with:
      path: ~/.gradle/wrapper/
      key: cache-clean-wrapper-${{ matrix.os }}-${{ matrix.jdk }}


  - name: Install bundle
    run: |
      cd android   # Change directory to the android directory where Gemfile is located
      bundle config path vendor/bundle   # Configure Bundler to use vendor/bundle directory
      bundle install --jobs 4 --retry 3 # Install gems specified in Gemfile
      



  - name: Set environment variables from secrets
    run: |
      echo "FIREBASE_APP_ID=${{ secrets.APP_ID }}" >> $GITHUB_ENV
      echo "FIREBASE_TOKEN=${{ secrets.TOKEN }}" >> $GITHUB_ENV



  - name: Build Gradle
    run: flutter build apk --debug


  - name: Add Firebase App Distribution Plugin
    run: |
      cd android
      bundle exec fastlane add_plugin firebase_app_distribution


  - name: Distribute app with 🔥 App Distribution 🚀
    run: |
      cd android   # Change directory to the android directory where Gemfile is located
      bundle exec fastlane distribute
      

还有这个快速文件 默认平台(:android)

平台:android

desc "Lane for distributing app using Firebase App Distributions"
lane :distribute do
    firebase_app_distribution(
        firebase_cli_token: ENV["FIREBASE_TOKEN"],
        app: ENV['FIREBASE_APP_ID'],
        release_notes: "last build",
        groups: "tester",
        debug: true,
        android_artifact_type: "APK",
        firebase_cli_path: "/usr/local/bin/firebase",
        apk_path: '../build/app/outputs/flutter-apk/app-debug.apk'
    )
end

结束

希望这能解决您的问题,它对我有用。

© www.soinside.com 2019 - 2024. All rights reserved.