feat: add automated deployment workflow for prod branch#157
Conversation
Add .github/workflows/deploy.yml that triggers on push to the prod branch. The pipeline runs unit tests, E2E tests, and lint as gates before applying D1 migrations and deploying to Cloudflare Workers. Update README.md with automated deployment documentation and CLOUDFLARE_API_TOKEN setup instructions.
There was a problem hiding this comment.
Pull request overview
Adds a production CI/CD pipeline that deploys the Cloudflare Worker automatically when the prod branch is updated, and documents the new flow for operators.
Changes:
- Introduces
.github/workflows/deploy.ymltriggered by pushes toprod, gating deployment on unit + E2E tests. - Runs production D1 migrations and deploys via
pnpm db:migrate:prodandpnpm run deploy. - Updates
README.mdwith CI/CD deployment instructions and requiredCLOUDFLARE_API_TOKENsetup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| README.md | Documents the new automated prod deployment workflow and required secrets. |
| .github/workflows/deploy.yml | Adds a new GitHub Actions workflow to test, run E2E, migrate D1, and deploy on prod pushes. |
| on: | ||
| push: | ||
| branches: [prod] | ||
|
|
There was a problem hiding this comment.
Consider adding a concurrency group for this workflow (or at least for the deploy job) to prevent overlapping production deploys. Without concurrency/cancel-in-progress, two quick pushes to prod can run two deploy jobs in parallel and the older run may finish last, effectively redeploying an older commit after a newer one.
| retention-days: 30 | ||
|
|
||
| deploy: | ||
| needs: [test, e2e] |
There was a problem hiding this comment.
The deploy job uses a repo-level secret (CLOUDFLARE_API_TOKEN) and runs on every push to prod. If you intend to gate production deployments, consider using a GitHub Actions environment: production on the deploy job so you can enforce required reviewers / deployment protection rules and scope secrets to that environment.
| needs: [test, e2e] | |
| needs: [test, e2e] | |
| environment: production |
Summary
.github/workflows/deploy.yml— automated deployment pipeline triggered on push toprodbranchCLOUDFLARE_API_TOKENsetup instructionsDeployment Flow
Required Secret
CLOUDFLARE_API_TOKENmust be set as a GitHub repository secret with Workers Scripts: Edit, D1: Edit, and Account Settings: Read permissions.