Reputation: 237
I'm trying to write a custom Travis env variable to a file for a simple proof of concept thing that I need. However, I'm having trouble getting this to work.
How would I define this in the travis yaml file if my variable is called VARIABLE_X ?
Thanks!
Upvotes: 0
Views: 438
Reputation: 34071
Write the environment variable as usual (Shell - Write variable contents to a file)
Define the following within script
:
- echo "$VARIABLE_X" > example.txt
Upvotes: 0
Reputation: 1265
One way to do this is using linux commands, something like:
printenv | grep VARIABLE > all_env
However I don't know how Travis handles the environment (take a look at their docs, here) but it might not work as easily due to encryption, but it should work since your apps wouldn't function if they didn't have the same level of access. If such a case occurs, modifying a few parameters (maybe TRAVIS_SECURE_ENV_VARS
) is worth looking into.
If you solved the problem in another way, consider sharing with the community.
Upvotes: 0