Fastlane Github 集成 - 作者身份未知

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

我正在构建一个管道,使用 fastlane 和 git hub 操作通过应用程序测试器分发我的 QA 构建。

作为管道的一部分,我也在修改版本代码并创建一个分支。 fastlane 作业在本地运行时工作正常,例如

fastlane deploy_firebase_test_build
在我的终端。但是,当我通过 Github Actions 运行此作业时,出现以下错误。

FastlaneCore::Interface::FastlaneShellError: [!] Exit status of command 'git commit -am 'Version bump to 106'' was 128 instead of 0.
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

我尝试在我的

.yml
文件中设置配置,但那时我收到错误消息。

Fastfile

default_platform(:android)

platform :android do

    before_all do
        ENV["FIREBASE_LOGIN_CREDENTIALS"] = "fastlane/sandbox_firebase_auth.json"
        ENV["FIREBASE_APP_ID"] = "*******************************"
    end

    #Firebase Distribution
    desc "Submit test build to App Tester"
    lane :deploy_firebase_test_build do |options|

       #Increment version code
       increment_version_code(gradle_file_path: "./app/build.gradle")

       #Build and assemble sandbox debug
       gradle(task: "clean")
       gradle(task: "assemble", flavor: "sandbox", build_type: "debug")


       #Fetch version code from gradle
       new_version = get_version_name(
            gradle_file_path:"./app/build.gradle",
            ext_constant_name:"versionCode"
        )

        # find apk path
         output_path = "./app/build/outputs/apk/sandbox/debug/"
         output_json_path = output_path + "output-metadata.json"
         build_output = load_json(json_path: output_json_path)
         elements = build_output["elements"][0]
         apk_path = output_path + elements["outputFile"]

            firebase_app_distribution(
                    app: ENV["FIREBASE_APP_ID"],
                    apk_path: apk_path,
                    release_notes_file: "sandboxchangelog.txt",                
                    groups_file: "fastlane/groups.txt",
                    service_credentials_file: ENV["FIREBASE_LOGIN_CREDENTIALS"]
              )

                #Checkout new branch with new version code
                sh("git checkout -b 'JIRA-000-Version-Bump-#{new_version}'")

                #Create commit with new version code
                sh "git commit -am 'Version bump to #{new_version}'"

                #Push commit
                push_to_git_remote
           end
         end

.YML File

name: Build and Distribute - Manual

on:
  workflow_dispatch:

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - run: git config --global user.name "*********"
    - run: git config --global user.email "**************"

    - name: Set up Ruby Environment
      uses: ruby/setup-ruby@v1
      with:
        ruby-version: '2.7.2'
        bundler-cache: true

    - 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_SANDBOX_CREDENTIALS }}
      
    - name: Distribute Sanbox via Apptester
      run: bundle exec fastlane deploy_firebase_test_build
      env:
        FIREBASE_APP_ID: ${{ secrets.SANDBOX_APP_ID }}
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

我对 fastlane 和 github 操作很陌生。任何人都可以在这里帮助我并引导我朝着正确的方向前进,或者任何人都可以告诉我我需要做什么才能解决这个问题?

提前致谢

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

您必须将建议的 git 配置行放在远程构建中给出消息的命令之前,即

sh "git commit -am 'Version bump to #{new_version}'"
之前和
#Create commit with new version code
之后。否则很容易断章取义:

                #Checkout new branch with new version code
                sh("git checkout -b 'JIRA-000-Version-Bump-#{new_version}'")

                #Create commit with new version code
                sh "git config --global user.email '[email protected]'"
                sh "git config --global user.name 'Your Name'"
                sh "git commit -am 'Version bump to #{new_version}'"

                #Push commit
                push_to_git_remote

这还有一个好处是,您可以控制新版本代码提交的这些属性在

Fastfile
中的消息旁边,并且您可以轻松地将它们绑定为构建属性(示例中未显示,因为这不是重点,应该相对清除有问题的 Fastfile,否则评论)。

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