Skip to content

Commit eeb3325

Browse files
committed
upate workflow
1 parent 1500b69 commit eeb3325

1 file changed

Lines changed: 41 additions & 7 deletions

File tree

.github/workflows/sync-logseq-content.yml

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,53 @@ jobs:
4949
echo "files_before=$before" >> $GITHUB_OUTPUT
5050
echo "files_after=$after" >> $GITHUB_OUTPUT
5151
52-
- name: Check for changes in content/
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/
5384
id: changes
5485
run: |
5586
cd quartz-site
5687
git add content/
88+
git add -f public/
5789
if git diff --staged --quiet; then
5890
echo "has_changes=false" >> $GITHUB_OUTPUT
5991
echo "No changes detected — skipping deploy."
6092
else
61-
changed=$(git status --porcelain content/ | wc -l)
93+
changed=$(git diff --staged --name-only | wc -l)
6294
echo "has_changes=true" >> $GITHUB_OUTPUT
6395
echo "changed_count=$changed" >> $GITHUB_OUTPUT
6496
fi
6597
66-
- name: Commit and push source files to Web-live
98+
- name: Commit and push changes to Web-live
6799
if: steps.changes.outputs.has_changes == 'true'
68100
run: |
69101
cd quartz-site
@@ -72,17 +104,19 @@ jobs:
72104
COMMIT_SHA=$(cd ../logseq-source && git rev-parse --short HEAD)
73105
74106
git add content/
75-
git commit -m "sync: content updated from Logseq (Admin@$COMMIT_SHA)"
107+
git add -f public/
108+
git commit -m "sync: ${{ steps.changes.outputs.changed_count }} file(s) updated from Logseq (Admin@$COMMIT_SHA)"
76109
git push origin Web-live
77110
78111
- name: Summary
79112
run: |
80113
if [ "${{ steps.changes.outputs.has_changes }}" == "true" ]; then
81-
echo "### ✅ Sync complete" >> $GITHUB_STEP_SUMMARY
114+
echo "### ✅ Sync & Build complete" >> $GITHUB_STEP_SUMMARY
82115
echo "- **Files before:** ${{ steps.sync.outputs.files_before }}" >> $GITHUB_STEP_SUMMARY
83116
echo "- **Files after:** ${{ steps.sync.outputs.files_after }}" >> $GITHUB_STEP_SUMMARY
84-
echo "- Changes pushed to **Web-live**. Vercel will build and deploy automatically." >> $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
85119
else
86120
echo "### ⏭️ No changes" >> $GITHUB_STEP_SUMMARY
87-
echo "Content was already up to date — no commit made." >> $GITHUB_STEP_SUMMARY
121+
echo "Content and build output were already up to date — no commit made." >> $GITHUB_STEP_SUMMARY
88122
fi

0 commit comments

Comments
 (0)