From 10380d787ccdf99bc7f0692983fc9e8d6463bee6 Mon Sep 17 00:00:00 2001 From: Lupita Bot <263059171+lupita-hom@users.noreply.github.com> Date: Wed, 4 Mar 2026 12:16:05 -0600 Subject: [PATCH] ci: add deploy-demo workflow to sync demo branch and deploy to GitHub Pages Triggers on pushes to main (client/ changes) or manual dispatch. Merges main into demo branch, builds with REACT_APP_DEMO_MODE=true, and deploys to GitHub Pages. --- .github/workflows/deploy-demo.yml | 73 +++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/deploy-demo.yml diff --git a/.github/workflows/deploy-demo.yml b/.github/workflows/deploy-demo.yml new file mode 100644 index 0000000..5eb5501 --- /dev/null +++ b/.github/workflows/deploy-demo.yml @@ -0,0 +1,73 @@ +name: Deploy Demo to GitHub Pages + +on: + push: + branches: [main] + paths: + - 'client/**' + - '.github/workflows/deploy-demo.yml' + workflow_dispatch: + +permissions: + contents: write + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: true + +jobs: + sync-and-deploy: + name: 🎭 Sync & Deploy Demo + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Checkout demo branch + uses: actions/checkout@v4 + with: + ref: demo + fetch-depth: 0 + + - name: Sync main into demo + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git fetch origin main + # Merge main into demo, keeping demo's versions on conflict + git merge origin/main --no-edit -X ours || { + echo "⚠️ Merge conflict — resolving with demo branch versions" + git checkout --ours . + git add . + git commit --no-edit + } + git push origin demo + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + cache-dependency-path: client/package-lock.json + + - name: Install dependencies + working-directory: client + run: npm ci --legacy-peer-deps + + - name: Build demo + working-directory: client + env: + REACT_APP_DEMO_MODE: 'true' + PUBLIC_URL: '/RunWatch' + run: npm run build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: client/build + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4