Skip to content

A ready-to-use CI/CD Pipeline for deploying your Cloudflare Workers .

License

Notifications You must be signed in to change notification settings

fluent-ci-templates/cloudflare-pipeline

Repository files navigation

Cloudflare Pipeline

fluentci pipeline deno module deno compatibility dagger-min-version

A ready-to-use CI/CD Pipeline for deploying your applications to Cloudflare Workers / Cloudflare Pages.

🚀 Usage

Run the following command:

fluentci run cloudflare_pipeline

🧩 Dagger Module

Use as a Dagger Module:

dagger install github.com/fluent-ci-templates/cloudflare-pipeline@main

Call functions from the module:

# Deploy to Cloudflare Workers
dagger call deploy --src . \
  --api-token CF_API_TOKEN \
  --account-id $CF_ACCOUNT_ID \
  --project-name $PROJECT_NAME

# Deploy to Cloudflare Pages
dagger call pages-deploy --src . \
  --api-token CF_API_TOKEN \
  --account-id $CF_ACCOUNT_ID \
  --directory dist \
  --project-name $PROJECT_NAME

🛠️ Environment Variables

Variable Description
CF_API_TOKEN Your Cloudflare API Token.
CF_ACCOUNT_ID Your Cloudflare Account ID.
DIRECTORY The directory to deploy to Cloudflare Pages. Defaults to .
PROJECT_NAME The name of your project.

✨ Jobs

Job Description
deploy Deploys your Worker to Cloudflare.
pagesDeploy Deploy a directory of static assets as a Pages deployment.
pagesDeploy(
  src: string | Directory,
  apiToken: string | Secret,
  accountId: string,
  directory: string,
  projectName: string,
): Promise<string>

deploy(
  src: string | Directory,
  apiToken: string | Secret,
  accountId: string
): Promise<string>

👨‍💻 Programmatic usage

You can also use this pipeline programmatically:

import { deploy } from "jsr:@fluentci/cloudflare";

await deploy(
  ".", 
  Deno.env.get("CF_API_TOKEN")!, 
  Deno.env.get("CF_ACCOUNT_ID")!
);