This will take your private Obsidian vault repo, and publish it to GitHub pages using Quartz.
The current way that Quartz works is kind of odd. It requires you to have the full source code of Quartz in a git repository, then have your Vault within the content
directory of Quartz. Odd.
I’ve built a GitHub action that obfuscates much of the setup of Quartz so all you’ll need for your GitHub pages repository is the quartz.config.ts
file, along with the deploy.yml
GitHub action
There are actually a few things that are needed for this to work.
- Your Obsidian vault needs to notify the GitHub pages repo on push, which requires a Personal Access Token.
- GitHub actions will run a quartz build on the GitHub Pages repo, requiring it to pull your vault, which requires a Deploy Key.
- Quartz will then publish it’s output to GitHub Pages.
Choose your repo for hosting the GitHub pages content. I’m going to use my User github.io repository along with a CNAME file so my notes can be accessed via a custom URL.
Create a SSH Deploy Key
In your terminal, ssh-keygen -t ed25519 -C "[email protected]"
No password, find the Public and Private keys in ~/.ssh/
Vault Repo
Add the Public key (.pub) as a Deploy Key
Your GitHub pages repo
Add the Private key as an Action Secret. (I called it OBSIDIANDEPLOYKEY)
Create an Access Token
This is needed for permission to run the Dispatch. Create a fine-grained PAT. Give it Actions Read & Write permissions on the Quartz repository.
Vault repo
Add the token as an Action Secret.
GitHub Pages repo
Add in the deploy.yml
file.
.github/workflows/deploy.yml
You should also put your quartz.config.ts
file in the root of the repo
Vault repo
The only addition to the vault repo is the following file
.github/workflows/dispatch.yml
Finally
Commit the Github Pages repo first. It should build the Vault repo and publish to Github Pages. After a successful build, then commit the Vault repo. At this point, any Pushes to the Vault repo will trigger a dispatch to the Pages repo and built it.