Skip to content

ci: auto-deploy to Cloudflare on merge to main#173

Merged
softmarshmallow merged 1 commit into
mainfrom
ci/enable-auto-deploy
Jun 27, 2026
Merged

ci: auto-deploy to Cloudflare on merge to main#173
softmarshmallow merged 1 commit into
mainfrom
ci/enable-auto-deploy

Conversation

@softmarshmallow

@softmarshmallow softmarshmallow commented Jun 27, 2026

Copy link
Copy Markdown
Member

What

Enable automatic production deploys. Merging to main now runs the existing deploy.yml (migrate → proxy → mock → web) — the closest thing to a Vercel-style flow on Cloudflare. The manual workflow_dispatch button stays.

Why

The playground (#172) is merged to main but never reached production: deploy.yml was manual-trigger-only and had never run (repo secrets weren't set). Secrets are now configured (CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID, verified for D1 + Workers access). This PR flips on the auto-trigger so the merge ships everything currently on main.

Bug fix included

The D1 migrate step was gated on if: ${{ inputs.migrate }}, which is empty on push events → auto-deploys would silently skip migrations. Now: if: ${{ github.event_name == 'push' || inputs.migrate }}.

Security (open-source repo)

  • Deploy creds are encrypted GitHub secrets, referenced via ${{ secrets.* }} — never hardcoded.
  • deploy.yml triggers only on push-to-main / manual dispatch (fork PRs can't reach it); ci.yml uses no secrets, so fork PRs can't exfiltrate.
  • No .dev.vars/.env tracked; gitignore confirmed.

Merging this triggers the first real production deploy.

Summary by CodeRabbit

  • New Features
    • Deployments now automatically run when changes are pushed to the main branch.
    • Manual deployment is still available for on-demand releases.
  • Chores
    • Database migrations are now applied automatically during supported deployment runs.

Uncomment the push: trigger so merges to main deploy automatically
(migrate -> proxy -> mock -> web), matching a Vercel-style flow while
keeping the manual workflow_dispatch button.

Also fix the D1 migrate gate: it was if: inputs.migrate, which is empty
on push events, so auto-deploys would silently skip migrations. Now runs
on every push and on manual dispatch when the toggle is on.
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 07b15199-65b6-481d-b93c-d8e5f6b9ed09

📥 Commits

Reviewing files that changed from the base of the PR and between 0f406df and 681f321.

📒 Files selected for processing (1)
  • .github/workflows/deploy.yml

Walkthrough

The deployment workflow now triggers on pushes to main as well as manual dispatch. The D1 migration step runs for push events and for manual runs when migrate is enabled. Other deployment steps are unchanged.

Changes

Deployment workflow auto-run

Layer / File(s) Summary
Trigger update
.github/workflows/deploy.yml
Workflow comments and trigger settings now include push-based runs on main alongside manual dispatch.
Migration gating
.github/workflows/deploy.yml
The D1 migration step now executes for push events and for manual dispatch when inputs.migrate is true.

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions as "GitHub Actions"
  participant DeployWorkflow as "deploy.yml"
  participant D1Step as "Apply D1 migrations (remote)"
  participant ProxyWorker as "proxy worker"
  participant MockWorker as "mock worker"
  participant OpenNextWeb as "web via OpenNext"

  GitHubActions->>DeployWorkflow: push to main or workflow_dispatch
  DeployWorkflow->>D1Step: run when trigger and migrate condition match
  DeployWorkflow->>ProxyWorker: deploy
  DeployWorkflow->>MockWorker: deploy
  DeployWorkflow->>OpenNextWeb: deploy
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/enable-auto-deploy

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@softmarshmallow softmarshmallow merged commit 48e6daf into main Jun 27, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant