Hi,
Currently, I have to use if else with branch name to hard code the export env like as below:
if [ "$CIRCLE_BRANCH" = "dev" ]; then
echo 'export REACT_APP_BASE_URL="$DEV_xxxxxx"' >> $BASH_ENV
fi
if [ "$CIRCLE_BRANCH" = "test" ]; then
echo 'export REACT_APP_BASE_URL="$TEST_xxxxxx"' >> $BASH_ENV
fi
if [ "$CIRCLE_BRANCH" = "stag" ]; then
echo 'export REACT_APP_BASE_URL="$STAG_xxxxx"' >> $BASH_ENV
fi
if [ "$CIRCLE_BRANCH" = "prod1" ]; then
echo 'export REACT_APP_BASE_URL="$PROD1_xxxxxx"' >> $BASH_ENV
fi
Obviously, it’s too much if else and when I need to release to a new client, I should go to Circleci config to update the new branch.
My idea is can we use the command export env like:
echo ‘export REACT_APP_BASE_URL="${Branchname}_xxxxxx"’ >> $BASH_ENV
?
Thanks,