Search code examples
bashenvironment-variablesprovisioning-profilefastlanefastlane-match

how to export a fastlane env to the main shell environment?


I have a CI setup on bitrise that's sort of like this:

# first script
fastlane match appstore
# second script
bash mycommands.sh

Now mycommands.sh needs access to one of the outputs of the first script, specifically the UDID of the provisioning profile that was pulled. If I do the match step inside a lane, the UDID would be available as ENV['sigh_com.******_development'], but it's not available to the environment outside the first script. So how can I make it available to commands that run after the first script has completed? Thanks!


Solution

  • One option is to wrap both within a fastlane lane:

    Fastfile:

    lane :do_something do |options|
      match(type: 'appstore')
      sh "mycommands.sh"
    end
    

    Quick'n'dirty way (I REALLY don't recommend relying on this as it's fragile for a number of reasons, but if you need this for something quick):

    fastlane match appstore | grep 'Profile UUID' | awk '{ print $7 }'