I want to use the same config.yml file for both my “staging” and “production” builds + deploys. In Github, our “main” branch is for staging, and our “production” branch is for production. I need some way to set an ENV var that can be used in my config.yml file to represent either “staging” or “production” based on the branch being built.
I know I can set this on jobs that I control, but I also use Orb pre-built jobs like pushing a docker image to Amazon:
- aws-ecr/build-and-push-image:
requires:
- build
tag: staging-rails
I want to be able to replace that “tag” statement above with something like this:
tag: ${MY_BUILD_ENV}-rails
and have logic that sets the env var like this:
if $CIRLCE_BRANCH == "production" then
$MY_BUILD_ENV = "production"
else
$MY_BUILD_ENV = "staging"
end
Is there any way to do this sort of dynamic ENV setting, and be able to use it both for my own jobs that I define, as well as in pre-defined Orb jobs? Basically trying to set a global env that I can use anywhere in config.yml.
Any help would be appreciated!