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

Provide example using cloudflare pages #587

Closed
hadley opened this issue Jul 18, 2022 · 7 comments · Fixed by #855
Closed

Provide example using cloudflare pages #587

hadley opened this issue Jul 18, 2022 · 7 comments · Fixed by #855
Labels
documentation feature a feature request or enhancement

Comments

@hadley
Copy link
Member

hadley commented Jul 18, 2022

It's similar to netlify (including deploy previews), but has unlimited bandwidth and build-in analytics. @wch has been experimenting with it so can provide more details.

@gaborcsardi
Copy link
Member

The only limit that does not look good is 500 builds per month. E.g. if we are deploying the dev sites of all packages for every CI run, then that does not seem like a lot.
https://developers.cloudflare.com/pages/platform/limits/

Nevertheless, we can have support for it, 500 is plenty for a lot of people.

@wch
Copy link
Member

wch commented Jul 18, 2022

I'm pretty sure that limit is if you use their CI system to build the site. That used to be a requirement, but just a couple months ago they added the ability to upload static files directly. https://blog.cloudflare.com/cloudflare-pages-direct-uploads/

What I'm doing is building the site using GitHub Actions, then deploying it as a set of static files to Cloudflare Pages. https://developers.cloudflare.com/pages/framework-guides/deploy-anything/

This is what I use in my GHA workflow (after building the site):

      - name: Publish to Cloudflare Pages
        uses: cloudflare/[email protected]
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          command: pages publish _site/ --project-name=my_project --commit-dirty=true

The pricing is good. Free for unlimited traffic. https://www.cloudflare.com/plans/developer-platform/#overview (Follow the link, then click on "Cloudflare Pages" on the left)

@wch
Copy link
Member

wch commented Jul 18, 2022

Now that I think about it a bit more, I'm unsure whether the direct upload counts as a build. Probably a good idea to ask them at https://community.cloudflare.com/

@hadley
Copy link
Member Author

hadley commented Jul 18, 2022

@gaborcsardi yeah, I don't think we'd plan to use it for package sites (since GitHub pages already does seem), but having deploy previews is useful for books, and it avoids the potentially large cost overruns that we have with netlify. For that usage, I think 500 builds/deploys a month is likely to be plenty.

@gaborcsardi
Copy link
Member

So, it turns out that the example for this is exactly the same as the example for GH Pages. Once you connect CF Pages to a GH repo, their app is watching that repo, and it will automatically pick up the branch and directory you selected.

E.g. https://actions-61h.pages.dev/ is deployed from the regular pkgdown workflow: https://github.com/r-lib/actions/blob/v2-branch/examples/pkgdown.yaml

I'll document this in the README of the examples.

@gaborcsardi
Copy link
Member

And yes, it seems that deploying a static site is also a build, even though the build command is exit 0. But they count it as a build.

They do have a preview system. I haven't tried, but I imagine that they'll build PRs against that target branch, so you'll get previews automatically.

Copy link

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue and include a link to this issue

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants