ci: label-gated Cloudflare previews and a visible site version #18

Merged
circleci-bot merged 10 commits from ci/previews-and-version into main 2026-11-15 13:16:33 +00:00
Member

Why

Cloudflare previews on CircleCI, like Forgejo's today, but only when asked for, so drive-by PRs don't spend Cloudflare usage. And a visible site version, to see what's live.

What changed

  • ci: same-repo PRs with the preview label get a Cloudflare preview version (wrangler versions upload --preview-alias pr-<n>) and one comment: the PR preview link and "this commit on its own" link, as preview.yml posts. The job checks the label first and stops before any Cloudflare call without it. The label takes effect on the next push, because CircleCI gets push events, not label events. PR content enters only as public/ via git archive, wrangler config and lockfiles come from main, and installs use --ignore-scripts. Not part of gate. Logs a site-preview deploy marker.
  • ci: the artifact preview is opt-in (artifact_preview pipeline parameter, API run), so a PR without the label runs only lint, test and gate. Fork PRs keep the artifact preview until cutover; forks never get Cloudflare tokens.
  • feat: a "Version: …" footer and /version.json (version, commit, build time), stamped at build time as YYYY.MM.DD.<run>+<sha7>, in CircleCI's deploy and previews and in Forgejo's deploy.yml and preview.yml, so the live site shows its version now. The repo copy says "dev". Deploy markers use the same version string.
  • docs: README and docs/ci.md.

Testing

circleci config validate, orb conftest policies (16 pass), routing checked for every event, mise run lint (actionlint) and mise run test. Live test on this PR: it carries the preview label, so the run should post the Cloudflare preview comment.

## Why Cloudflare previews on CircleCI, like Forgejo's today, but only when asked for, so drive-by PRs don't spend Cloudflare usage. And a visible site version, to see what's live. ## What changed - ci: same-repo PRs with the `preview` label get a Cloudflare preview version (`wrangler versions upload --preview-alias pr-<n>`) and one comment: the PR preview link and "this commit on its own" link, as `preview.yml` posts. The job checks the label first and stops before any Cloudflare call without it. The label takes effect on the next push, because CircleCI gets push events, not label events. PR content enters only as `public/` via `git archive`, wrangler config and lockfiles come from main, and installs use `--ignore-scripts`. Not part of `gate`. Logs a `site-preview` deploy marker. - ci: the artifact preview is opt-in (`artifact_preview` pipeline parameter, API run), so a PR without the label runs only lint, test and `gate`. Fork PRs keep the artifact preview until cutover; forks never get Cloudflare tokens. - feat: a "Version: …" footer and `/version.json` (version, commit, build time), stamped at build time as `YYYY.MM.DD.<run>+<sha7>`, in CircleCI's deploy and previews and in Forgejo's `deploy.yml` and `preview.yml`, so the live site shows its version now. The repo copy says "dev". Deploy markers use the same version string. - docs: README and `docs/ci.md`. ## Testing `circleci config validate`, orb conftest policies (16 pass), routing checked for every event, `mise run lint` (actionlint) and `mise run test`. Live test on this PR: it carries the `preview` label, so the run should post the Cloudflare preview comment.
chore: re-run CI
All checks were successful
ci/circleci: setup-pr
Preview / Preview on Cloudflare (pull_request) Successful in 16s
7d336c439f
Owner
<!-- preview-deploy --> **Preview:** https://pr-18-magicbean-site.hckr-5e0.workers.dev This commit (e0db259383b1) on its own: https://5eea07b9-magicbean-site.hckr-5e0.workers.dev
fix(ci): pipe JSON into jq instead of a here-string (<< breaks the config)
Some checks failed
ci/circleci: setup-pr
ci/circleci: gate
ci/circleci: lint
ci/circleci: test
ci/circleci: preview-cloudflare
Preview / Preview on Cloudflare (pull_request) Has been cancelled
27bd8eab7b
ci: gate Cloudflare previews on a sticky ci: preview label (Forgejo's preview label is one-shot)
Some checks failed
Preview / Preview on Cloudflare (pull_request_target) Has been skipped
ci/circleci: setup-pr
Preview / Preview on Cloudflare (pull_request) Has been cancelled
ci/circleci: lint
ci/circleci: test
ci/circleci: gate
ci/circleci: preview-cloudflare
f5f6e0c02f
chore: re-run CI
All checks were successful
ci/circleci: setup-pr
ci/circleci: lint
ci/circleci: test
ci/circleci: gate
ci/circleci: preview-cloudflare
Preview / Preview on Cloudflare (pull_request) Successful in 17s
c651c7b08a
Member
<!-- circleci-cloudflare-preview --> **Preview:** https://pr-18-magicbean-site.hckr-5e0.workers.dev This commit (e0db259383b1) on its own: https://529c58a9-magicbean-site.hckr-5e0.workers.dev
drcrow force-pushed ci/previews-and-version from c651c7b08a
All checks were successful
ci/circleci: setup-pr
ci/circleci: lint
ci/circleci: test
ci/circleci: gate
ci/circleci: preview-cloudflare
Preview / Preview on Cloudflare (pull_request) Successful in 17s
to 87077645a4
Some checks failed
Preview / Preview on Cloudflare (pull_request) Has been cancelled
ci/circleci: setup-pr
2026-11-15 13:09:30 +00:00
Compare
fix(ci): pipe JSON into jq in the preview PR lookup (rebase brought the here-string back)
All checks were successful
ci/circleci: test
ci/circleci: setup-pr
ci/circleci: gate
ci/circleci: lint
ci/circleci: preview-cloudflare
Preview / Preview on Cloudflare (pull_request) Successful in 18s
e0db259383
Sign in to join this conversation.
No description provided.