Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anujdeshpande opened this issue Sep 14, 2022 · 11 comments
Assignees
Labels
enhancement New feature or request pages:validated A validated Pages issue pages Relating to Pages

Comments

@anujdeshpande
Copy link

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 anujdeshpande added the bug Something that isn't working label Sep 14, 2022
@anujdeshpande
Copy link
Author

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.

@rozenmd rozenmd added the pages Relating to Pages label Sep 14, 2022
@matheusfillipe
Copy link

@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?

@anujdeshpande
Copy link
Author

@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

@matheusfillipe
Copy link

@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.

@GregBrimble
Copy link
Member

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 GregBrimble changed the title 🐛 BUG: pages publish doesn't deploy to production even if a commit on master triggers it Feature Request: ability to change production branch of Direct Upload Pages project Sep 21, 2022
@GregBrimble GregBrimble added enhancement New feature or request and removed bug Something that isn't working labels Sep 21, 2022
@WalshyDev WalshyDev added the pages:validated A validated Pages issue label Oct 19, 2022
@Keavon
Copy link

Keavon commented Aug 23, 2023

For the record, there's a workaround described here: cloudflare/pages-action#63 (comment)

@benvinegar
Copy link

Hi there, I've been working on an open source project built on Cloudflare Pages + Workers called Counterscale, and I've been bit so many times by this issue.

I want to experiment with one-off production builds of test branches, but it's impossible to specify that on the command line.

@irvinebroque
Copy link
Contributor

@benvinegar trying to catch myself up — my understanding is that this is what you (and others) expect to work:

Given a Cloudflare Pages project where the "Production branch" is set to main

Screenshot 2024-08-04 at 10 53 43 AM

...and that runs at projectname-dji3.pages.dev, that you can:

  1. Build your project locally
  2. npx wrangler pages deploy --branch=main
  3. See your deployment reflected in production at projectname-dji3.pages.dev

...but that in practice, running this spits back a preview URL:

b667a309.projectname-dji3.pages.dev

Correct?

@coreybutler
Copy link

I'd like there to be a choice to not have a branch at all. For example, our workflow uses GitHub releases for production releases. I'd rather source files from there.

@benvinegar
Copy link

@irvinebroque Sorry for the slow reply.

I basically just want to say

npx wrangler pages deploy --production

or

npx wrangler pages deploy --preview

If that's not possible, then sure, indicating the branch name is the next best thing.

But I feel the dependency on git branches is confusing. Why can't I just download some files and deploy? I agree with @coreybutler on this.

@Ricardonacif
Copy link

The dependency on the git branch doesn't make any sense for the direct upload. It's ok to assume the environment using the git branch, but there definitely should be an option to override it. A simple --env would fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request pages:validated A validated Pages issue pages Relating to Pages
Projects
None yet
Development

No branches or pull requests