Fix workflow and link in DSA #44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Logseq → Quartz Content | |
| on: | |
| push: | |
| branches: | |
| - Admin | |
| paths: | |
| - "pages/**" # runs when notes in pages/ change | |
| workflow_dispatch: # allows manual trigger from GitHub Actions UI | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout Admin branch (Logseq source) | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: Admin | |
| path: logseq-source | |
| - name: Checkout Web-live branch (Quartz site) | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: Web-live | |
| path: quartz-site | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Sync pages/ → content/ | |
| id: sync | |
| run: | | |
| SOURCE="logseq-source/pages" | |
| DEST="quartz-site/content" | |
| # Use rsync to sync files, deleting removed files, but excluding index.md | |
| rsync -av --delete --exclude="index.md" "$SOURCE"/ "$DEST"/ | |
| - name: Check for changes in content/ | |
| id: changes | |
| run: | | |
| cd quartz-site | |
| git add content/ | |
| if git diff --staged --quiet; then | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| echo "No changes detected — skipping deploy." | |
| else | |
| changed=$(git diff --staged --name-only | wc -l) | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| echo "changed_count=$changed" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push changes to Web-live | |
| if: steps.changes.outputs.has_changes == 'true' | |
| run: | | |
| cd quartz-site | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| COMMIT_SHA=$(cd ../logseq-source && git rev-parse --short HEAD) | |
| git commit -m "sync: ${{ steps.changes.outputs.changed_count }} file(s) updated from Logseq (Admin@$COMMIT_SHA)" | |
| git push origin Web-live | |
| - name: Summary | |
| run: | | |
| if [ "${{ steps.changes.outputs.has_changes }}" == "true" ]; then | |
| echo "### ✅ Sync complete" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Changed files:** ${{ steps.changes.outputs.changed_count }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- Content pushed to **Web-live**. Hosting provider will trigger build." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "### ⏭️ No changes" >> $GITHUB_STEP_SUMMARY | |
| echo "Content was already up to date — no commit made." >> $GITHUB_STEP_SUMMARY | |
| fi |