Another possible method to interpolate values into your config is to use a run
step to export environment variables to BASH_ENV
, as shown below.
steps: - run: name: Setup Environment Variables command: | echo "export PATH=$GOPATH/bin:$PATH" >> $BASH_ENV echo "export GIT_SHA1=$CIRCLE_SHA1" >> $BASH_ENV
In every step, CircleCI uses bash
to source BASH_ENV
. This means that BASH_ENV
is automatically loaded and run, allowing you to use interpolation and share environment variables across run
steps.
Note: The $BASH_ENV
workaround only works with bash
. Other shells probably won’t work.