| name | dev-cloudflare-pages-ci-setup |
| description | Set up Cloudflare Pages deployment with GitHub Actions workflows. Use when: (1) Deploying a static site to Cloudflare Pages, (2) User says 'cloudflare pages', 'deploy to cloudflare', 'cf pages setup', (3) User wants CI/CD workflows for Cloudflare Pages with PR previews, (4) Setting up wrangler deployment pipelines. |
Cloudflare Pages CI Setup
Set up Cloudflare Pages deployment with GitHub Actions workflows for static sites. Supports production deploys, PR preview deploys, and named preview branches.
Step 1: Gather Project Info
Identify the project's build setup:
cat package.json
ls .github/workflows/ 2>/dev/null
cat wrangler.toml 2>/dev/null
Determine: package manager (pnpm/npm/yarn), build command, output directory (dist/, build/, out/), base path (root / or subpath like /pj/project-name/).
Step 2: Ask User Preferences
- Cloudflare Pages project name (used in
--project-name)
- Which workflows: Main only, Main + PR previews, Main + PR + named previews
- Base path: root
/ or specific subpath
- IFTTT notifications: yes/no
Step 3: Create Cloudflare Configuration
wrangler.toml
compatibility_date = "2024-12-01"
Add wrangler devDependency
pnpm add -D wrangler