Last active
January 25, 2025 15:28
-
-
Save aczw/7b31a8a94398478f2f13867deb46dc75 to your computer and use it in GitHub Desktop.
GitHub Actions workflow for syncing Obsidian vault and Quartz (using Bun). Replace the placeholder values as necessary.
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: Update vault content | |
| on: | |
| schedule: | |
| - cron: '0 11 * * MON' # Run every Monday at 11 AM UTC (6 AM EST, 7 AM EDT) | |
| workflow_dispatch: | |
| jobs: | |
| update_vault_content: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Clone aczw/<VAULT_REPO> | |
| uses: actions/[email protected] | |
| with: | |
| repository: 'aczw/<VAULT_REPO>' | |
| ref: main | |
| token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
| path: <VAULT_REPO> | |
| - name: Clone this repo | |
| uses: actions/[email protected] | |
| with: | |
| ref: v4 | |
| token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} | |
| path: <QUARTZ_REPO> | |
| - name: Delete everything in content/ except index.md | |
| run: | | |
| cd <QUARTZ_REPO> | |
| mv content/index.md . | |
| rm -rf content | |
| mkdir content | |
| mv index.md content | |
| - name: Copy over media and files | |
| run: | | |
| cd <VAULT_REPO> | |
| echo "----- Copying over public-only attachments" | |
| cp -vr <PUBLIC_ATTACHMENTS_FOLDER> ../<QUARTZ_REPO>/content | |
| echo -e "\n----- Copying over Markdown files" | |
| cp -vr <YOUR_NOTES_FOLDER>/. ../<QUARTZ_REPO>/content | |
| cd ../<QUARTZ_REPO>/content | |
| mv <PUBLIC_ATTACHMENTS_FOLDER> _files | |
| # ^ Include this last line if you want to rename your public folder | |
| - name: Print out current state of filesystem | |
| run: | | |
| echo "----- Folder: <QUARTZ_REPO>/" | |
| cd <QUARTZ_REPO> | |
| ls | cat | |
| echo -e "\n----- Folder: <QUARTZ_REPO>/content/" | |
| ls content | cat | |
| echo -e "\n----- Folder: <QUARTZ_REPO>/content/_files" | |
| ls content/_files | cat | |
| # ^ NOTE: this uses the renamed folder name from above | |
| - name: Install Bun just to run literally two commands | |
| uses: oven-sh/[email protected] | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: | | |
| cd <QUARTZ_REPO> | |
| bun i | |
| - name: Setup Git config (user and email), necessary for commits | |
| run: | | |
| git config --global user.name "Porter Robinson" | |
| git config --global user.email "[email protected]" | |
| - name: Sync Quartz repo | |
| run: | | |
| cd <QUARTZ_REPO> | |
| bun quartz sync |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment