Reusable, zero-local-credential GitHub Actions deployment workflows shared across organizations.
- Template Method + Strategy: Common safety guards (
workflow_dispatch,refs/heads/main,dry_rundefaulttrue, concurrency lock, account mismatch check, runtime-secret guard, post-deploy version/binding readback, HTTP probes) live here once. - Public + GitHub Free Private compatibility: Pass
environment: web-productionfor public repos; omitenvironmentfor GitHub Free private repos so repository secrets are used automatically. - Unified secret naming:
CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_API_TOKEN(scoped to a single account with least privilege)CLOUDFLARE_WRANGLER_CONFIG(whenmaterialize_config: true)
name: Cloudflare Workers Deploy
on:
workflow_dispatch:
inputs:
dry_run:
type: boolean
default: true
required: true
permissions: {}
jobs:
deploy:
uses: CodeGovernanceLab/CloudDeployKit/.github/workflows/cloudflare-worker-deploy.yml@<FULL_COMMIT_SHA>
permissions:
contents: read
with:
dry_run: ${{ inputs.dry_run }}
runtime: node-worker
environment: web-production
test_command: npm test
build_command: npm run build
config_url_var: APP_ORIGIN
probes_json: '[{"path":"/","status":200},{"path":"/api/overview","status":401}]'
secrets:
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_WRANGLER_CONFIG: ${{ secrets.CLOUDFLARE_WRANGLER_CONFIG }}