1- name : Sync Logseq → Quartz Content & Build
1+ name : Sync Logseq → Quartz Content
22
33on :
44 push :
1010 workflow_dispatch : # allows manual trigger from GitHub Actions UI
1111
1212jobs :
13- sync-and-build :
13+ sync :
1414 runs-on : ubuntu-latest
1515 permissions :
1616 contents : write
@@ -35,57 +35,14 @@ jobs:
3535 SOURCE="logseq-source/pages"
3636 DEST="quartz-site/content"
3737
38- # Count files before sync
39- before=$(find "$DEST" -name "* .md" ! -name "index.md" | wc -l)
38+ # Use rsync to sync files, deleting removed files, but excluding index.md
39+ rsync -av --delete --exclude="index .md" "$SOURCE"/ "$DEST"/
4040
41- # Delete stale notes (keeps index.md intact)
42- find "$DEST" -name "*.md" ! -name "index.md" -delete
43-
44- # Copy notes from Admin branch to Web-live branch
45- cp -r "$SOURCE"/. "$DEST"/
46-
47- # Count files after sync
48- after=$(find "$DEST" -name "*.md" ! -name "index.md" | wc -l)
49- echo "files_before=$before" >> $GITHUB_OUTPUT
50- echo "files_after=$after" >> $GITHUB_OUTPUT
51-
52- - name : Setup Node.js
53- uses : actions/setup-node@v4
54- with :
55- node-version : 22
56-
57- - name : Cache node_modules
58- id : cache-node-modules
59- uses : actions/cache@v4
60- with :
61- path : quartz-site/node_modules
62- key : ${{ runner.os }}-node-modules-${{ hashFiles('quartz-site/package-lock.json') }}
63-
64- - name : Install dependencies
65- if : steps.cache-node-modules.outputs.cache-hit != 'true'
66- run : |
67- cd quartz-site
68- npm ci
69-
70- - name : Cache Quartz build cache
71- uses : actions/cache@v4
72- with :
73- path : quartz-site/.quartz-cache
74- key : ${{ runner.os }}-quartz-cache-${{ github.run_id }}-${{ github.run_attempt }}
75- restore-keys : |
76- ${{ runner.os }}-quartz-cache-
77-
78- - name : Build Quartz site
79- run : |
80- cd quartz-site
81- npx quartz build
82-
83- - name : Check for changes in content/ and public/
41+ - name : Check for changes in content/
8442 id : changes
8543 run : |
8644 cd quartz-site
8745 git add content/
88- git add -f public/
8946 if git diff --staged --quiet; then
9047 echo "has_changes=false" >> $GITHUB_OUTPUT
9148 echo "No changes detected — skipping deploy."
@@ -103,20 +60,16 @@ jobs:
10360 git config user.email "github-actions[bot]@users.noreply.github.com"
10461 COMMIT_SHA=$(cd ../logseq-source && git rev-parse --short HEAD)
10562
106- git add content/
107- git add -f public/
10863 git commit -m "sync: ${{ steps.changes.outputs.changed_count }} file(s) updated from Logseq (Admin@$COMMIT_SHA)"
10964 git push origin Web-live
11065
11166 - name : Summary
11267 run : |
11368 if [ "${{ steps.changes.outputs.has_changes }}" == "true" ]; then
114- echo "### ✅ Sync & Build complete" >> $GITHUB_STEP_SUMMARY
115- echo "- **Files before:** ${{ steps.sync.outputs.files_before }}" >> $GITHUB_STEP_SUMMARY
116- echo "- **Files after:** ${{ steps.sync.outputs.files_after }}" >> $GITHUB_STEP_SUMMARY
117- echo "- **Changed files (source & build):** ${{ steps.changes.outputs.changed_count }}" >> $GITHUB_STEP_SUMMARY
118- echo "- Pre-built \`public/\` files pushed to **Web-live**. Vercel will deploy instantly." >> $GITHUB_STEP_SUMMARY
69+ echo "### ✅ Sync complete" >> $GITHUB_STEP_SUMMARY
70+ echo "- **Changed files:** ${{ steps.changes.outputs.changed_count }}" >> $GITHUB_STEP_SUMMARY
71+ echo "- Content pushed to **Web-live**. Hosting provider will trigger build." >> $GITHUB_STEP_SUMMARY
11972 else
12073 echo "### ⏭️ No changes" >> $GITHUB_STEP_SUMMARY
121- echo "Content and build output were already up to date — no commit made." >> $GITHUB_STEP_SUMMARY
74+ echo "Content was already up to date — no commit made." >> $GITHUB_STEP_SUMMARY
12275 fi
0 commit comments