secondsky/claude-skills / plugins/cloudflare-workers/skills/cloudflare-workers-ci-cd
cloudflare-workers-ci-cd
VerifiedComplete CI/CD guide for Cloudflare Workers using GitHub Actions and GitLab CI. Use for automated testing, deployment pipelines, preview environments, secrets management, or encountering deployment failures, workflow errors, environment configuration issues.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 15.8 KB |
| references/deployment-strategies.md | markdown | 8.7 KB |
| references/github-actions.md | markdown | 10.0 KB |
| references/gitlab-ci.md | markdown | 3.4 KB |
| references/secrets-management.md | markdown | 7.6 KB |
| scripts/verify-deployment.sh | script | 4.7 KB |
| templates/github-actions-full.yml | config | 4.5 KB |
| templates/gitlab-ci-full.yml | config | 5.3 KB |
| templates/preview-deployment.yml | config | 6.9 KB |
| templates/rollback-workflow.yml | config | 8.7 KB |
references/gitlab-ci.md
View on GitHub# GitLab CI for Cloudflare Workers
Complete guide for GitLab CI/CD pipelines for Workers.
## Basic Pipeline Structure
**.gitlab-ci.yml**:
```yaml
image: oven/bun:latest
stages:
- test
- deploy
variables:
FF_USE_FASTZIP: "true" # Faster caching
cache:
paths:
- node_modules/
- .bun/
test:
stage: test
script:
- bun install
- bun test --coverage
coverage: '/Lines\s*:\s*(\d+\.\d+)%/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage/cobertura-coverage.xml
deploy:
stage: deploy
script:
- bun install
- bunx wrangler deploy
only:
- main
environment:
name: production
url: https://my-worker.workers.dev
```
## Multi-Environment Deployments
```yaml
deploy-staging:
stage: deploy
script:
- bunx wrangler deploy --env staging
only:
- develop
environment:
name: staging
url: https://my-worker-staging.workers.dev
deploy-production:
stage: deploy
script:
- bunx wrangler deploy --env production
only:
- main
environment:
name: production
url: https://my-worker.workers.dev
when: manual # Requires manual trigger
```
## Review Apps (Preview Deployments)
```yaml
review:
stage: deploy
script:
- bunx wrangler deploy --env review-$CI_MERGE_REQUEST_IID
environment:
name: review/$CI_COMMIT_REF_SLUG
url: https://my-worker-review-$CI_MERGE_REQUEST_IID.workers.dev
on_stop: stop_review
only:
- merge_requests
stop_review:
stage: deploy
script:
- bunx wrangler delete --name my-worker-review-$CI_MERGE_REQUEST_IID
environment:
name: review/$CI_COMMIT_REF_SLUG
action: stop
when: manual
only:
- merge_requests
```
## Secrets Management
### Setting Variables
**Project Settings → CI/CD → Variables → Add variable**:
- `CLOUDFLARE_API_TOKEN` (masked, protected)
- `DATABASE_URL` (masked, protected)
- `STRIPE_SECRET_KEY` (masked, protected)
### Using Variables
```yaml
deploy:
script:
- echo "$DATABASE_URL" | bunx wrangler secret put DATABASE_URL --env production
- echo "$STRIPE_SECRET_KEY" | bunx wrangler secret put STRIPE_SECRET_KEY --env production
- bunx wrangler deploy --env production
environment:
name: production
```
### Environment-Specific Variables
Create variables scoped to environments:
```yaml
deploy-production:
variables:
ENVIRONMENT: "production"
script:
- echo "$DATABASE_URL_PRODUCTION" | bunx wrangler secret put DATABASE_URL
environment:
name: production
```
## Advanced Patterns
### Conditional Deployment
```yaml
deploy:
script:
- bunx wrangler deploy
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: always
- if: '$CI_COMMIT_TAG'
when: never
- changes:
- src/**/*
- wrangler.jsonc
```
### Parallel Jobs
```yaml
test:
parallel:
matrix:
- BUN_VERSION: ['latest', '1.1.0']
image: oven/bun:${BUN_VERSION}
script:
- bun install
- bun test
```
### Deploy to Multiple Workers
```yaml
deploy-api:
script:
- cd workers/api
- bunx wrangler deploy
deploy-frontend:
script:
- cd workers/frontend
- bunx wrangler deploy
```
## Caching
```yaml
cache:
key:
files:
- bun.lockb
paths:
- node_modules/
- .bun/
```
## Resources
- GitLab CI Docs: https://docs.gitlab.com/ee/ci/
- Workers Deployment: https://developers.cloudflare.com/workers/
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |