How to specify "production" deploy via wrangler?

We're not using the git integration, but still pass "--branch" parameters when deploying so that we get aliasing. The problem seems to be that unless the branch name is main, all deploys are considered previews. Is there a way around this or some undocumented method to consider a specific preview as the production version of a page?
6 Replies
Chaika
Chaika3mo ago
Like, your "main" branch is master instead of main, and thus they're not considered production, or you want multiple branches to be production? You can change (although only via the API for Direct Upload Projects), the branch that is considered to be the production branch
nick_flux
nick_flux3mo ago
Thanks for the quick reply again Our branching workflow is pr->main->rc->prod, where prod is production. We've setup separate Pages for each branch (so pr, main, rc, prod).
We want the "production" version for each Page to reflect the latest deploy to that Page so that we can easily configure a CNAME to e.g., rc.pages.dev.
The only way it seems like that is possible is if we pass the --branch=main flag which is very confusing because the UI shows then shows "main" for a deploy that actually originated from the "rc" branch
Devon
Devon3mo ago
i think you can set the "production" branch for each Pages app separately, so you should be able to do what you're wanting to do. Although I can't figure out how to change it after the fact...
Chaika
Chaika3mo ago
You can only change the production branch via the API of a Direct upload project in Firefox using Edit and Resend like https://discord.com/channels/595317990191398933/789155108529111069/1207029322783924254 or via API, Patch to PATCH "https://api.cloudflare.com/client/v4/accounts/<account id>/pages/projects/<project name>" Body of {"production_branch": "master"} (or whatever you want it to be
Devon
Devon3mo ago
Thanks!
nick_flux
nick_flux3mo ago
Nice, thank you both. This should work for us
Want results from more Discord servers?
Add your server
More Posts