GitHub - cloudflare/pages-action

That's exactly what I'm researching now đź‘Ť https://github.com/cloudflare/pages-action/ One thing I can't figure out is how to define which branches are preview vs production when using direct upload rather than connecting it to Git -- seems the dashboard loses the ability to configure it.
GitHub
GitHub - cloudflare/pages-action
Contribute to cloudflare/pages-action development by creating an account on GitHub.
8 Replies
Shados
Shados•13mo ago
So looking at my projects, if it was once connected to a github repo, you should still have the build & deployments options and you can configure it there (you can pass whatever branch you want from the github action, you can even "lie" and it will still work). If it was deployed directly from the get go, the options don't show up o.O Wonder if thats a bug.
Shados
Shados•13mo ago
Looks like by default it will use main for prod and everything else for preview, and you can change it with the API https://community.cloudflare.com/t/missing-builds-deploy-settings-page/416091/2 Not ideal though.
Cloudflare Community
Missing "Builds & Deploy" settings page
It sounds like you’re looking at a specific deployment. The “Builds and Deployments” settings can be found on the Project:
Rich
Rich•13mo ago
ha interesting. I think it must be a bug as obv a lot of the options in the dash aren't applicable, but the preview branch and prod branch config is
Cyb3r-Jak3
Cyb3r-Jak3•13mo ago
Yeah the api offers the way to change the production branch
Shados
Shados•13mo ago
I love cloudflare pages, but damn the dev tooling can be rough sometimes* at least I can confirm that if you use a main branch convention, this just works without configuration just pass in the branch name via the github action, if its main, it goes to prod, if its anything else, preview. and use the api if you use master or something to change it. (just tested it on my side app)
Rich
Rich•13mo ago
yeah I think I can prob get away with using main tbh -- just didn't want to commit to main while I experiment with it all. Good to know you can change it via API if necessary though.
Rich
Rich•13mo ago
GitHub
No way to define if production or preview env · Issue #63 · cloudfl...
Hey, So want to use CF pages on a monorepo which the new workingDirectory feature was designed for. Problem is, to use with monorepos, project has to be defined as a "direct upload" proje...
Rich
Rich•13mo ago
Ok, I have that setup so I can deploy any branch to prod or preview, I just rename 'main' -> 'canary' if somebody chooses to deploy the actual main branch to preview
branch: ${{ github.event.inputs.env == 'production' && 'main' || github.ref_name == 'main' && 'canary' || github.ref_name }}
branch: ${{ github.event.inputs.env == 'production' && 'main' || github.ref_name == 'main' && 'canary' || github.ref_name }}
Super gross, but I think does the job. Another thing I'd love to sort out is to pass the commit SHA so I can know what is actually deployed to CF, any idea if that's possible?
Want results from more Discord servers?
Add your server