Skip to content

Cloudflare Pages

This content is not available in your language yet.

Every push to main triggers a Cloudflare Pages deployment via GitHub Actions. The CI pipeline also runs linting, type checking, and security scans before building.

The release.yml workflow handles production deployments from version tags.

Pull requests get automatic preview deployments, so you can review changes before merging to main.

Terminal window
pnpm build
# Deploy via wrangler
npx wrangler pages deploy dist --branch=main
# Or via Cloudflare Dashboard
# Project: astro-cloudflare

Set these in your Cloudflare Pages dashboard or GitHub repository:

SecretPurpose
CF_API_TOKENCloudflare API token for deployments
CF_ACCOUNT_IDYour Cloudflare account ID
SITE_URLCanonical URL of your site
CLEANUP_SECRETBearer token guarding the R2 cleanup endpoint (only if you use R2)

The R2_MEDIA binding in wrangler.jsonc connects to a Cloudflare R2 bucket for larger media assets. The secret-guarded functions/api/cleanup.ts worker can prune orphaned objects. Remove the binding and worker if you don’t need R2.

  • main — Production builds
  • Feature branches — Preview builds triggered from pull requests