How to set up environment variable in CI/CD?

Hello, I have an architecture where my backend is hosted APIs are hosted in heroku and I am using Netlify for CDN for React application.

I am trying to set up merge request review deployment, so we can review the apps online. The react app would have to call out to the backend API URL that changes for different review branches. I need to set an environment variable REACT_APP_API_URL to something like during my CI/CD setup but since Netlify review branches get deployed automatically, it seems impossible to set this variable. I tried to do some deployment manually during CI/CD using the netlify CLI, but it looks like there is no support for environment variable injection (at least yet??).

How are people handling scenarios like this when you need to set dynamic environment variables?

Hmm, I’m not 100% sure this is what you need, but does this seem relevant to your question?