how to deploy to production?
I've setup a cloudflare pages project on a branch of an existing repo, and cannot figure out how to deploy to production or my custom domain; every deployment is just labelled as preview... reading the documentation it seems that production deployments only occur via the default branch, so I've since changed the default branch on github to be my cfpages branch as well as in my local repo, however wrangler perhaps still hasn't detected this? And I find no way to manually promote a preview deployment to a production deployment (my ideal workflow).
2 Replies
You need to update the production branch setting on the Pages project, if its linked to Git you can do that on the UI but otherwise it has to be through the API: https://community.cloudflare.com/t/missing-builds-deploy-settings-page/416091/6?u=erisa-cf
Cloudflare Community
Missing "Builds & Deploy" settings page
You can change it with the API. curl -X PATCH "https://api.cloudflare.com/client/v4/accounts//pages/projects/" \ -H "Authroization: Bearer \ -H "Content-Type: application/json" \ --data '{"production_branch": "master"}'
@Erisa | Support Engineer hrmmm that's quite inconvenient - I'd prefer to just delete the pages project and set it up in a way that does provide the appropriate GUI dashboard - how can I do that, as everytime I've tried to create this project, the appropriate GUI dashboards aren't available
okay, I just deleted it, and updated github to use the
main
branch and moved my code there instead, then cloned again, and used wrangler again, then setup the env vars again
I hope in the future this becomes easier