Skip to content

Add Cloudflare Pages deploy target#20

Open
dannywillems wants to merge 1 commit intomainfrom
feat/cloudflare-pages
Open

Add Cloudflare Pages deploy target#20
dannywillems wants to merge 1 commit intomainfrom
feat/cloudflare-pages

Conversation

@dannywillems
Copy link
Copy Markdown
Contributor

Summary

  • Add CloudflarePages deployer for static site hosting via wrangler pages deploy
  • Extend DnsProvider trait with CNAME record support (upsert/delete) with default error implementations so existing providers (OVH) don't break
  • Implement CNAME methods for Cloudflare DNS provider
  • Extend Deployer trait with is_remote() and cname_target() for local deployers
  • Make host CLI argument optional for non-remote deployers
  • Pipeline auto-creates CNAME records pointing to {project}.pages.dev after deploy

Usage

let web = App::new("my-site")
    .build_cmd("npm run build")
    .build_dir("dist");

let caddy = Caddy::new();

let pipeline = Pipeline::new(web, caddy)
    .dns(Cloudflare::new("my-site.example.com"))
    .deploy(CloudflarePages::new("my-project"));

pipeline.run()?;

Test plan

  • cargo check compiles
  • cargo clippy -- -D warnings passes
  • cargo fmt --check passes
  • cargo test all 107 tests pass (including doc-tests)
  • cargo doc --no-deps builds successfully
  • Manual test with a real Cloudflare Pages project and wrangler CLI

Closes #17

Add CloudflarePages deployer for static site hosting via wrangler.
The pipeline builds locally and publishes via `wrangler pages deploy`,
with automatic CNAME DNS setup through the DnsProvider trait.

Changes:
- App: add build_cmd and build_dir fields for static site builds
- DnsProvider trait: add upsert/delete CNAME default methods
- Cloudflare DNS: implement CNAME record management
- Deployer trait: add is_remote() and cname_target() methods
- CloudflarePages: new deployer using wrangler CLI
- Pipeline: branch on is_remote(), make host optional for local
  deployers, auto-create CNAME records after deploy

Closes #17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Cloudflare Pages as a deploy target for static sites

1 participant