nakeer
nakeer

Reputation: 767

Returning value from fastlane fastfile

My shell script would trigger a fastlane action (ruby) and I need return some value back to the shell script

One option being suggested everywhere is to set it as a env variable. But unable to print the value in shell script.

Fastlane action

platform :ios do
  desc "Description of what the lane does"
  lane :getData do
        ENV['FL_VALUE'] = "Test"
  end
end

Sample shell script

!/bin/sh
...
bundle exec fastlane getData
...
echo $FL_VALUE

other suggestions were to write the data into some file and read it from the shell script. But would prefer to use the env variable.

Upvotes: 5

Views: 5344

Answers (1)

Marc Attinasi
Marc Attinasi

Reputation: 5734

The project I am working on calls fastlane scripts from Groovy scripts. We have the lanes take an output_file option and write their results there. The Groovy scripts then read the results from the file. Cumbersome, but effective.

BTW: we also have an error_file option so errors can be written out similarly...

Upvotes: 1

Related Questions