Skip to content

Instantly share code, notes, and snippets.

@viktorbenei
Last active November 18, 2024 10:41
Show Gist options
  • Save viktorbenei/89fba333e58ba34483cb to your computer and use it in GitHub Desktop.
Save viktorbenei/89fba333e58ba34483cb to your computer and use it in GitHub Desktop.
[DEPRECATED - SEE COMMENT] Bitrise: save environment to .bash_profile
#!/bin/bash
#
# To export an environment for other steps in your workflow you have to add the environment variable to
# a persistent environment store. Every step runs in it's own shell session and so if
# a previous step just exports an environment it won't be available for other steps,
# unless you add it to a persistent store (like .bash_profile)
#
#
# you can save an environment to .bash_profile in a bash script like this:
echo 'export MYTESTENV="my test value"' >> ~/.bash_profile
#
# then in the subsequent steps you can get and use it like this:
# echo "MYTESTENV: ${MYTESTENV}"
#
#
# if you want to use the variable in the same step too then you have to export it the regular way:
export MYTESTENV="my test value"
@viktorbenei
Copy link
Author

DON'T USE THIS ANYMORE. The current recommended way to exposing environment variables is via envman (https://github.com/bitrise-io/envman)

Guide: https://devcenter.bitrise.io/en/builds/environment-variables.html#setting-and-managing-env-vars-during-a-build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment