Skip to content

Commit

Permalink
Source GITHUB_ENV before trying to access env vars set in fastlane in…
Browse files Browse the repository at this point in the history
… the same step
  • Loading branch information
roryabraham committed Oct 1, 2024
1 parent 9cb7974 commit 45a589d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/buildAndroid.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ jobs:
esac
bundle exec fastlane android "$lane"
# Reload environment variables from GITHUB_ENV
source "$GITHUB_ENV"
SHOULD_UPLOAD_SOURCEMAPS='false'
if [ -f ./android/app/build/generated/sourcemaps/react/productionRelease/index.android.bundle.map ]; then
SHOULD_UPLOAD_SOURCEMAPS='true'
Expand Down
12 changes: 2 additions & 10 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ KEY_DSYM_PATH = "dsymPath"
KEY_S3_APK_PATH = "s3APKPath"
KEY_S3_HTML_PATH = "s3HtmlPath"

# Export environment variables in the parent shell.
# In a GitHub Actions environment, it will save the environment variables in the GITHUB_ENV file.
# In any other environment, it will save them to the current shell environment using the `export` command.
# Export environment variables to GITHUB_ENV
# If there's no GITHUB_ENV file set in the env, then this is a no-op
def exportEnvVars(env_vars)
github_env_path = ENV['GITHUB_ENV']
if github_env_path && File.exist?(github_env_path)
Expand All @@ -35,13 +34,6 @@ def exportEnvVars(env_vars)
file.puts "#{key}=#{value}"
end
end
else
puts "Saving environment variables in parent shell..."
env_vars.each do |key, value|
puts "#{key}=#{value}"
command = "export #{key}=#{value}"
system(command)
end
end
end

Expand Down

0 comments on commit 45a589d

Please sign in to comment.