从 fastlane fastfile 返回值

nak*_*eer 5 ruby fastlane

我的 shell 脚本将触发 fastlane 操作 (ruby),我需要将一些值返回给 shell 脚本

到处都建议的一种选择是将其设置为环境变量。但无法在 shell 脚本中打印该值。

快车道行动

platform :ios do
  desc "Description of what the lane does"
  lane :getData do
        ENV['FL_VALUE'] = "Test"
  end
end
Run Code Online (Sandbox Code Playgroud)

shell 脚本示例

!/bin/sh
...
bundle exec fastlane getData
...
echo $FL_VALUE
Run Code Online (Sandbox Code Playgroud)

其他建议是将数据写入某个文件并从 shell 脚本中读取。但更喜欢使用 env 变量。

Mar*_*asi 1

我正在从事的项目从 Groovy 脚本调用 fastlane 脚本。我们让泳道做出output_file选择并将结果写在那里。然后 Groovy 脚本从文件中读取结果。麻烦,但有效。

顺便说一句:我们还有一个error_file选项,因此可以类似地写出错误......