Versioning a Blot site with GitHub

One of the things I like about Blot is that the site is a folder. I can write in an ordinary text editor, add images by moving files around, and let Blot turn the result into a website. There is no content-management system between me and the files.

That simplicity left me with two related problems. I wanted proper version history and an off-site backup for the whole site, but I also wanted to publish the templates as open source without publishing every photograph, presentation and draft alongside them.

I have ended up with a small, slightly unusual arrangement:

iCloud Drive / Blot
        │
        ├── Blot sync ────────────→ live website
        │
        └── Git push ─────────────→ private monorepo
                                         │
                                         └── GitHub Action
                                                  │
                                                  ▼
                                      public template repository

The Blot folder in iCloud Drive is the canonical working copy. It contains the posts, pages, templates, fonts, images and presentations in the directory structure that Blot expects. That folder is also a Git repository whose remote is private on GitHub. I edit the files there, Blot notices the changes and updates the site, and Git gives me a separate history and backup when I commit and push.

The whole site cannot sensibly be public. The writing has its own licence; photographs and other assets have a mixture of rights; some fonts are commercially licensed; and drafts are drafts. The private repository can preserve all of that without pretending that everything in it has the same licence.

The reusable part lives in a second, public repository: tomscott-templates. Its root contains the files from Templates/index/, while images/site/ contains favicons, icons and the octopus printer’s mark used as site furniture.

I do not edit that public repository independently. A GitHub Actions workflow in the private repository checks out both repositories whenever the templates or site-furniture images change. It mirrors those selected directories into the public repository, preserves the public README, licence and documentation, and commits any differences as github-actions[bot].

This makes the direction of travel explicit:

Blot folder → private repository → public template repository

There is only one source of truth. That is more important than the particular tools. Two editable copies of a template will eventually drift, especially when one of them is also being used by a live publishing system.

The workflow needs a fine-grained GitHub personal access token because the standard token supplied to an Action can only write to the repository in which that Action is running. The additional token is restricted to the public template repository and has only the contents read-and-write permission. It is stored as an encrypted Actions secret and will need replacing when it expires.

There are a couple of other caveats. A Git repository inside a cloud-synchronised folder should not be edited simultaneously on several computers, and the files should be fully downloaded before running Git operations. The publication step is deliberately one way and uses a mirror operation, so files at the derived destination can be removed when they disappear from the source. The README, licence and documentation are explicitly excluded from that deletion.

Blot already explains how to move a template into the synced folder and put it under Git. The extra pieces here are treating the whole site as a private monorepo and deriving a carefully limited public repository from it.

I have documented the directory mapping, workflow and token setup in the public repository. It is a fairly small amount of machinery, but it now gives me the properties I wanted: ordinary local files, immediate publishing through Blot, private history for the complete site, and a public home for the parts that other people can inspect and reuse.