ci(demo): auto-create Pages project on first deploy (idempotent)

Project not found errors when pcbjam-demo doesn't exist yet; create it (with the
production branch matching --branch) before deploying so the pipeline is
self-contained.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Gergő Törcsvári 2026-06-19 13:37:43 +02:00
commit f3683bda39
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322

View file

@ -84,7 +84,17 @@ jobs:
- name: Build demo
run: node scripts/deploy/build-demo.mjs --tag "${{ steps.tag.outputs.tag }}" --cdn "$CDN"
# 4) Deploy to Cloudflare Pages (demo.pcbjam.com is the project's custom domain).
# 4) Ensure the Pages project exists (first deploy creates it; no-op after).
# Its production branch must equal PAGES_PROD_BRANCH or deploys land as
# previews and demo.pcbjam.com won't update.
- name: Ensure Pages project exists
run: >
npx --yes wrangler@4 pages project create "$PAGES_PROJECT"
--production-branch "$PAGES_PROD_BRANCH"
|| echo "pages project create skipped (already exists)"
# 5) Deploy to Cloudflare Pages. Attach demo.pcbjam.com to this project
# (Pages → $PAGES_PROJECT → Custom domains) for the custom domain to serve it.
- name: Deploy to Cloudflare Pages
run: >
npx --yes wrangler@4 pages deploy web/standalone/dist