Hub deploy dispatch: Deploy on merge on the public orchestrator
Since #1227, Deploy on merge doesn't run its deploys on the VPS. It plans on the VPS, then hands the deploys to Hub deploy dispatch (.github/workflows/hub-deploy-dispatch.yml on marklovely/lovely-hub-provision) and finishes. The public run uses GitHub's free runners for public repos, so deploys don't queue behind the one lovely-home runner and the hubs deploy side by side. What deploys when is unchanged: see deploying.md.
Template: docs/public-repo-workflow-template-deploy-dispatch.yml. Deploy on merge publishes it whenever it changes (scripts/sync-public-deploy-workflow.mjs, part of sync-all-public-orchestrator-workflows.mjs).
What a run does
- Resolve. Checks out home-dashboard at the merge commit, validates
parts(hub_jobs,hub_workers,hub_pages,marketing), and marks each partpendingon the commit. - Wait for CI. Polls the commit's
testandHub smoke (demo)statuses withscripts/wait-for-commit-ci.mjs. It skips this when the commit only changed paths CI ignores (wait_for_ci: false). - Deploy.
- hub-jobs Worker:
deploy-hub-jobs-worker-code.mjs. - Hub API Workers: a job per hub, up to 6 at a time. Each runs
scripts/deploy-hub-worker.mjs {site}: the hub's D1 migrations, then its Worker, the same npm scripts as on a laptop. A hub whose migrations fail doesn't deploy its Worker; the other hubs carry on. - Hub Pages: after the Workers. It runs Hub CD dispatch in the same repo and waits for it.
- Marketing site:
deploy-lovely-home-website.sh, which checks that lovely-home.co.uk serves the commit.
- hub-jobs Worker:
- Summary. Sets each part's final commit status (
Deploy: …) and posts one Slack #workflows message. If it can't check out home-dashboard (for example the token expired), it still tells Slack.
The private side (deploy-on-merge.yml, job Public deploy) only checks that the run started. If the workflow is missing, or the run fails straight away (a broken workflow file), that job fails and the VPS posts to Slack.
Logs are public: what they show
Any GitHub account can read these logs, and no setting makes them private on a public repo. So every deploy runs through scripts/run-quiet-deploy.mjs:
- The command's output goes to a file, never to the log. wrangler would otherwise print the Worker's bindings with plaintext vars (allowed origins, Access app IDs, coordinates).
- The log gets one line we write:
✓ Hub API Worker (demo): version 1a2b3c4d (14.2 s). The version comes from wrangler's output file (WRANGLER_OUTPUT_FILE_PATH). - Before anything runs, the hub's hostnames, IDs, coordinates and emails from
wrangler.tomlare registered with::add-mask::, so they show as***if they ever get printed. Secrets are masked by GitHub anyway. - When a deploy fails, the log shows wrangler's
[ERROR]lines and the full output goes to private R2:lovely-home-e2e-reports/deploy-logs/<run id>-{attempt}/{part}.log. Open it in the Cloudflare dashboard (R2 → bucket →deploy-logs/), or through the Access-protected reports hostname, the same way as the E2E reports. - The workflow also sets
WRANGLER_LOG=warn, so a wrangler call outside the quiet runner prints only warnings and errors.
Masking only hides values someone listed, and source code can't be masked: a build error prints the lines it failed on. CI runs the same build first, so a deploy rarely fails that way. Hub site ids show in job names, as they already do in Hub CD and provisioning.
Hub CD dispatch deploys each hub's Pages the same quiet way. For an older commit without run-quiet-deploy.mjs (a rollback), it still sends the output to a file and prints only the error lines.
Secrets
Nothing new.
| Secret | Repo | Used for |
|---|---|---|
PUBLIC_CI_DISPATCH_TOKEN | home-dashboard | Starting the run (Actions read and write on lovely-hub-provision) |
HOME_DASHBOARD_REPO, HOME_DASHBOARD_DISPATCH_TOKEN | lovely-hub-provision | Checkout, reading CI statuses and setting Deploy: … statuses (Contents read, Commit statuses read and write on home-dashboard) |
CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID | lovely-hub-provision | The deploys and the R2 log upload, only on the steps that deploy |
SLACK_WORKFLOWS_WEBHOOK_URL | lovely-hub-provision | The summary message |
Switch back to the VPS
Set repo variable DEPLOY_ON_MERGE_RUNNER to vps on home-dashboard. The next merge runs the jobs in deploy-on-merge.yml on the VPS, as before #1227. Unset it (or set public) to go back.
Troubleshooting
| Symptom | Look at |
|---|---|
Deploy: … stays pending | The public run, linked from the status. It may be waiting for CI, or queued behind another deploy (one at a time). A run replaced while it queued leaves its statuses pending; the next merge deploys those parts again (#1190). |
| Public deploy job failed on home-dashboard | Its log: missing workflow (run the sync), a 404 from the token, or a run that ended at once. |
| A hub failed | Its job's error lines, then the full log in R2 (the failed status names the folder). |
| Slack says it couldn't check out home-dashboard | HOME_DASHBOARD_DISPATCH_TOKEN on lovely-hub-provision expired or lost access. |