Can we have different Preview ENV Variables, for different branches?

We have several different staging/test environments we use to test various work across teams. With Vercel we were using designated deploy branches, that had their own domain & env vars setup. We would have branches like env/dev-1 that deployed to dev-1.test.com with all the correct ENV vars for that environment. I havent' seen a way to have deploys (GH Actions, wrangler) that have different env vars. Is there any way we can handle these? We expect our Preview deploys to be able to point to several different environments.
2 Replies
kian
kian12mo ago
Pages doesn't really support that - it only has two environments, Production and Preview.
unr
unrOP12mo ago
Yeah, that's what it appears currently. We tried overwriting them dynamically with GH Actions but that didn't seem to work either. Our current strategy is going to be creating individual "page apps" for each environment, so they have dedicated env vars. Unless there is a better suggestion I actually realized with GH Actions we can build our unique .env first, then push it up already built to CF Pages. This should work for now, as we're not building directly on CF
Want results from more Discord servers?
Add your server