I'm trying to have separate environment variables, in this case, API strings for the staging and prod branches of my front end SPA.
REACT_APP_APIURL="somethingsomething.com"
They are defined within .env files:
.env.production
.env.staging
I've defined scripts in the package.json to use those files depending on the custom build command:
"build:staging": "env-cmd -f .env.staging react-scripts build",
"build:production": "env-cmd -f .env.production react-scripts build",
So each branch has different azure-static-web-apps.yml file with a different app_build_command::
Branch: Staging
app_build_command: "npm run build:staging"
Branch: Prod
app_build_command: "npm run build:production"
But upon merging staging and prod in Github, I'll be forced to merge the azure-static-web-apps.yml file preventing me from having 2 separate build configurations for the 2 staging and prod environments. I don't want this
I've looking into Templates: https://docs.microsoft.com/en-us/azure/devops/pipelines/process/templates?view=azure-devops But it doesn't seem to be useful for this case.
This there a way to do this?