CI / CD
CI/CD (Continuous Integration / Continuous Deployment) automates testing and deployment of your code. When you push changes, the pipeline automatically runs quality checks, tests, and deploys to production-no manual steps required.
PageZERO includes a pre-configured pipeline using GitHub Actions and Cloudflare Workers.
How it works
- You push code to GitHub
- Pipeline runs linting, type checking, and unit tests in parallel
- E2E tests verify the app works end-to-end
- Database migrations run automatically
- Code deploys to Cloudflare Workers
- Smoke tests verify the deployment succeeded (optional)
Pipeline Overview
Environments
| Branch | Environment | Database | URL |
|---|---|---|---|
main | Production | Production D1 | Your custom domain |
| PR branches | Preview | Preview D1 | *.workers.dev |
Draft PRs only run quality checks, type checks, and tests. Database migrations and deployments are skipped until the PR is marked as ready for review.
For setup instructions, see the Automatic deployment section in the deployment guide.
Protecting Preview URLs (optional)
Section titled “Protecting Preview URLs (optional)”By default, preview deployments (*.workers.dev) are publicly accessible. You can restrict access using Cloudflare Zero Trust so only authorized users can view preview environments.
- Go to Cloudflare Zero Trust → Access → Applications
- Create a new Self-hosted application
- Set the application domain to your preview URL pattern (e.g.,
*.workers.dev) - Configure an Access policy to control who can access (e.g., specific email addresses or identity providers)
Once configured, users must authenticate before accessing preview URLs.
Smoke Tests (optional)
Section titled “Smoke Tests (optional)”Smoke tests run against the deployed URL to verify the deployment succeeded. They only run when CLOUDFLARE_ACCESS_CLIENT_ID is configured in GitHub Actions.
If your preview environment is protected by Cloudflare Zero Trust (see above), configure service authentication:
- Create a Service Token in Cloudflare Zero Trust
- Add a Service Auth policy to your Access application
- Add
CLOUDFLARE_ACCESS_CLIENT_IDas a GitHub Actions variable - Add
CLOUDFLARE_ACCESS_CLIENT_SECRETas a GitHub Actions secret
The pipeline uses these credentials to authenticate requests against protected URLs.
Preview Database Reset
Section titled “Preview Database Reset”A separate workflow can reset the preview database to a clean state. Trigger it manually from GitHub Actions when needed:
- Go to Actions → “Reset preview database”
- Click “Run workflow”
- Select the
mainbranch
This cleans the database, runs migrations, and seeds with fresh data.