For Direct Upload, can we change production branch for a Pages project?

I know that we can do that if connecting to a GitHub repo.

But if we use Direct Upload exclusively (e.g., built w/ GitHub actions to direct upload to Pages), can we use Cloudflare API or Wrangler to update production branch (eg., from “main” to “release-v3.0”)?

wrangler pages project create allows to pass --production-branch . But it seems to be a one-time thing. It would be great to have “wrangler pages project update --production-branch” or hopefully this endpoint works Cloudflare API v4 Documentation (tried, doesn’t seem to work)

I believe if you just run wrangler pages publish <directory> that it will default to the production branch. And you need to manually specific a branch to have it in preview mode wrangler pages publish <directory> --branch=<branch>.

Let’s say initially we create a project with production branch = “main”

To deploy to production, we run
wrangler pages publish <directory> --branch=main .

To deploy to preview, we run
To deploy to production, we run
wrangler pages publish <directory> --branch=<whatever name that is not "main"> .

My issue is how can we change “main” to something like “release-v3.0”.

This is a nice to have thing :slight_smile: It’s okay that we continue to use “main” forever, because we use direct upload and we don’t actually rely on git’s “branch” concept.

I don’t believe you need to specify --branch=main here. If you run this command under any branch then that will go to the production environment.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.