Skip to content

Cloudflare

Deploys a release artifact to Cloudflare, either as a Cloudflare Pages site or as a Cloudflare Worker with static assets.

The target extracts a ZIP artifact and shells out to the wrangler CLI to perform the deployment. wrangler is bundled in the Craft Docker image.

OptionDescription
deployTypepages (default) or worker.
projectNameCloudflare Pages project name. Required when deployType is pages.
productionBranchThe Pages project’s production branch name. Passed to wrangler pages deploy --branch so a release always targets the production environment. Default: main. This is the Cloudflare environment selector, not your git release branch.
wranglerCliPathPath to the wrangler binary. Default: wrangler (or the WRANGLER_BIN env var).
workingDirSubdirectory within the extracted artifact to deploy from. For worker deploys this is where the wrangler.toml lives.
NameDescription
CLOUDFLARE_API_TOKENCloudflare API token with permission to deploy Pages/Workers.
CLOUDFLARE_ACCOUNT_IDCloudflare account ID.

Both are required. They are passed to wrangler via the environment, never on the command line.

By default, this target:

  1. Looks for a single artifact matching cloudflare.zip (or *-cloudflare.zip). Override with includeNames.
  2. Extracts its contents (flattening a single top-level directory if present).
  3. Deploys via wrangler.

Cloudflare Pages (static site):

targets:
- name: cloudflare
deployType: pages
projectName: my-docs-site
productionBranch: main

Cloudflare Worker (with a wrangler.toml in the artifact):

targets:
- name: cloudflare
deployType: worker
workingDir: worker
  1. Create a cloudflare.zip artifact in your CI workflow (e.g. the built static site, or your Worker plus wrangler.toml).
  2. Configure the target in .craft.yml.
  3. Set CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID in your environment.