workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

Feature Request: ability to change production branch of Direct Upload Pages project

Open anujdeshpande opened this issue 1 year ago • 5 comments

What version of Wrangler are you using?

cloudflare/[email protected]

What operating system are you using?

Github Actions / ubuntu-latest

Describe the Bug

Here's a truncated log where it shows the wrangler command I use, and the output. This happens on the master branch - so I'd expect this to go to the production domain that I have configured in pages project. Instead it deploys to the preview domain

I notice that wrangler CLI allows me to set the production branch if I use it to create a pages project with --production-branch. But in my case I created the project from the web dashboard. So I don't have a way of telling cloudflare that the production branch is master and to treat commits on that branch as such

  with:
    apiToken: ***
    accountId: ***
    command: pages publish --project-name=conf-makerville ./
...
Using API Token authentication
$ Running: wrangler pages publish --project-name=conf-makerville ./
▲ [WARNING] Warning: Your working directory is a git repo and has uncommitted changes

  To silence this warning, pass in --commit-dirty=true


🌍  Uploading... (8335/8335)

✨ Success! Uploaded 172 files (8[16](https://github.com/Makerville/conference/actions/runs/3050695715/jobs/4918073087#step:4:17)3 already uploaded) (6.48 sec)

✨ Deployment complete! Take a peek over at https://4f10cf4f.conf-makerville.pages.dev/

anujdeshpande avatar Sep 14 '22 06:09 anujdeshpande

I recreated a pages project using the wrangler cli and was able to set the production branch while creating it. It would be nice to be able to set the production branch through the web dashboard - not just through the wrangler pages create cli. Another thing that could be done is to set the production branch as an input to the github action.

anujdeshpande avatar Sep 14 '22 07:09 anujdeshpande

@anujdeshpande I am also struggling with this issue. I am inside a repository but the files i want to publish are not part of the repository, they are the built static files that dont go to version control. I've been trying:

npx wrangler pages publish --branch=publish build/html --project-name "my-porject-name"

But doesn't work. It always ends up as preview. Does my current branch has to be literally called production or what?

matheusfillipe avatar Sep 20 '22 07:09 matheusfillipe

@matheusfillipe how did you create the project? I created the project using the wrangler CLI tool and explicitly said that I will be using the master branch as the one to build the site from

Something like this - wrangler pages project create $project-name --production-branch master

I recommend that you delete the current pages project that you have in the dashboard, and create a new one using the CLI like above

anujdeshpande avatar Sep 20 '22 11:09 anujdeshpande

@anujdeshpande that works! I agree that you should be able to change this branch after the project is created or alternatively be able to give it a flag like --env production.

matheusfillipe avatar Sep 20 '22 17:09 matheusfillipe

Thanks for creating this issue. We'll log this as a feature request to be able to change the production branch of Direct Upload projects.

GregBrimble avatar Sep 21 '22 14:09 GregBrimble