1- # Sync tribrid-rag/web to ragweld.com/vendor/demo when web/ changes
2- # This ensures the live demo stays in sync with the source code
3- #
4- # Setup required:
5- # 1. Create a GitHub Personal Access Token (PAT) with repo scope
6- # 2. Add it as a secret: RAGWELD_DEPLOY_TOKEN
7- # Settings > Secrets > Actions > New repository secret
8-
91name : Sync ragweld.com Demo
102
113on :
124 push :
135 branches : [main]
146 paths :
157 - ' web/**'
8+ - ' data/glossary.json'
9+ - ' data/models.json'
10+ - ' server/models/tribrid_config_model.py'
11+ - ' scripts/generate_types.py'
1612 - ' .github/workflows/sync-ragweld.yml'
17- workflow_dispatch : # Allow manual trigger
13+ schedule :
14+ - cron : ' 17 6 * * *'
15+ workflow_dispatch :
1816
1917jobs :
2018 sync-demo :
2119 runs-on : ubuntu-latest
20+
2221 steps :
23- - name : Checkout tribrid-rag
22+ - name : Require sync token
23+ env :
24+ RAGWELD_DEPLOY_TOKEN : ${{ secrets.RAGWELD_DEPLOY_TOKEN }}
25+ run : |
26+ if [ -z "${RAGWELD_DEPLOY_TOKEN}" ]; then
27+ echo "ERROR: RAGWELD_DEPLOY_TOKEN is required."
28+ echo "Create a classic or fine-grained PAT with write access to DMontgomery40/ragweld.com."
29+ echo "Then set it in this repo as Actions secret: RAGWELD_DEPLOY_TOKEN."
30+ exit 1
31+ fi
32+
33+ - name : Checkout ragweld
2434 uses : actions/checkout@v4
2535 with :
26- path : tribrid-rag
36+ path : ragweld
2737
2838 - name : Checkout ragweld.com
2939 uses : actions/checkout@v4
@@ -32,69 +42,46 @@ jobs:
3242 token : ${{ secrets.RAGWELD_DEPLOY_TOKEN }}
3343 path : ragweld.com
3444
35- - name : Sync web/ to vendor/demo/
36- run : |
37- # Backup MSW mocks (ragweld-specific)
38- if [ -d "ragweld.com/vendor/demo/src/mocks" ]; then
39- cp -R ragweld.com/vendor/demo/src/mocks /tmp/ragweld-mocks-backup
40- fi
41-
42- # Remove old demo source (keep node_modules if exists)
43- cd ragweld.com/vendor/demo
44- find . -maxdepth 1 ! -name 'node_modules' ! -name '.' -exec rm -rf {} +
45- cd ../../..
46-
47- # Copy fresh web/ source
48- cp -R tribrid-rag/web/* ragweld.com/vendor/demo/
49-
50- # Remove build artifacts and node_modules from copy
51- rm -rf ragweld.com/vendor/demo/node_modules
52- rm -rf ragweld.com/vendor/demo/dist
53- rm -rf ragweld.com/vendor/demo/.tests
54-
55- # Restore MSW mocks
56- if [ -d "/tmp/ragweld-mocks-backup" ]; then
57- rm -rf ragweld.com/vendor/demo/src/mocks
58- cp -R /tmp/ragweld-mocks-backup ragweld.com/vendor/demo/src/mocks
59- fi
60-
61- # Patch vite.config.ts: base /web/ -> /demo/
62- sed -i "s|base: '/web/'|base: '/demo/'|g" ragweld.com/vendor/demo/vite.config.ts
63-
64- # Patch demo entrypoint to keep ragweld-specific MSW bootstrap + /demo basename
65- node ragweld.com/scripts/patch-demo-entry.cjs
45+ - name : Set up Node.js
46+ uses : actions/setup-node@v4
47+ with :
48+ node-version : ' 20'
6649
67- - name : Check for changes
68- id : changes
50+ - name : Sync demo + parity check
6951 run : |
70- cd ragweld.com
71- git add -A
72- if git diff --staged --quiet; then
73- echo "No changes to commit"
74- echo "has_changes=false" >> $GITHUB_OUTPUT
75- else
76- echo "Changes detected"
77- echo "has_changes=true" >> $GITHUB_OUTPUT
78- fi
52+ node ragweld.com/scripts/sync-demo.cjs \
53+ --source ragweld/web \
54+ --source-sha "${GITHUB_SHA}" \
55+ --source-repo "DMontgomery40/ragweld"
7956
80- - name : Commit and push
81- if : steps.changes.outputs.has_changes == 'true'
57+ - name : Repair unexpected drift (non-allowlisted only)
8258 run : |
83- cd ragweld.com
84- git config user.name "github-actions[bot]"
85- git config user.email "github-actions[bot]@users.noreply.github.com"
86- git commit -m "chore: sync demo from tribrid-rag/web
87-
88- Auto-synced from tribrid-rag commit: ${{ github.sha }}
89-
90- Co-Authored-By: github-actions[bot] <github-actions[bot]@users.noreply.github.com>"
91- git push
59+ node ragweld.com/scripts/check-demo-parity.cjs --source ragweld/web --fix
60+ node ragweld.com/scripts/check-demo-parity.cjs --source ragweld/web
9261
93- - name : Summary
62+ - name : Remove OS junk files
9463 run : |
95- if [ "${{ steps.changes.outputs.has_changes }}" == "true" ]; then
96- echo "✅ Demo synced and pushed to ragweld.com"
97- echo "Netlify will auto-deploy from the push"
98- else
99- echo "ℹ️ No changes detected - demo already in sync"
100- fi
64+ find ragweld.com -name '.DS_Store' -delete
65+
66+ - name : Open or update sync PR
67+ uses : peter-evans/create-pull-request@v7
68+ with :
69+ token : ${{ secrets.RAGWELD_DEPLOY_TOKEN }}
70+ path : ragweld.com
71+ commit-message : " chore: sync demo from ragweld/web (${{ github.sha }})"
72+ branch : codex/sync-demo-${{ github.sha }}
73+ base : main
74+ title : " chore: sync demo from ragweld/web (${{ github.sha }})"
75+ body : |
76+ Automated sync from `DMontgomery40/ragweld` to `DMontgomery40/ragweld.com`.
77+
78+ Source commit: `${{ github.sha }}`
79+ Trigger: `${{ github.event_name }}`
80+
81+ This PR was generated by `.github/workflows/sync-ragweld.yml`.
82+ add-paths : |
83+ vendor/demo/**
84+ public/glossary.json
85+ labels : |
86+ automation
87+ sync
0 commit comments