diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index d2e0809..d284a85 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -1,7 +1,6 @@ -name: Deploy site to GitHub Pages - # Custom Pages build: compiles Thor from source via the Nix flake, uses it to # generate thor/site/, and publishes the result. Replaces the default Jekyll build. +name: Deploy site to GitHub Pages on: push: @@ -16,7 +15,6 @@ on: - ".github/workflows/pages.yml" workflow_dispatch: -# Least-privilege permissions required to deploy to GitHub Pages. permissions: contents: read pages: write @@ -35,19 +33,33 @@ jobs: uses: actions/checkout@v4 - name: Install Nix - uses: DeterminateSystems/nix-installer-action@main + uses: cachix/install-nix-action@v30 + with: + extra_nix_config: | + experimental-features = nix-command flakes - # Optional but recommended: caches the Nix store across runs so Thor - # (and its tree-sitter grammars) aren't rebuilt from scratch every time. - - name: Cache Nix store - uses: DeterminateSystems/magic-nix-cache-action@main + # Free cache: snapshots /nix/store into GitHub's Actions cache. The key is + # hashed over the inputs that change Thor's output, so a site-content-only + # change is a full hit (Thor not recompiled), while an Odin source change + # restores the nearest store and rebuilds just the delta. + - name: Cache /nix/store + uses: nix-community/cache-nix-action@v6 + with: + primary-key: nix-${{ runner.os }}-${{ hashFiles('flake.lock', '**/*.nix', '**/*.odin') }} + restore-prefixes-first-match: nix-${{ runner.os }}- + gc-max-store-size-linux: 2G + purge: true + purge-prefixes: nix-${{ runner.os }}- + purge-created: 604800 # drop entries older than 7 days + # First run compiles Thor + the tree-sitter grammar libs; later runs + # restore them from the cache above and skip the compile. - name: Build Thor run: nix build .#default --print-build-logs - name: Generate site working-directory: site - run: ../result/bin/thor --base-url "https://sbrow.github.io/thor" --minify + run: ../result/bin/thor -base-url=https://sbrow.github.io/thor -minify - name: Upload Pages artifact uses: actions/upload-pages-artifact@v3 diff --git a/site/thor.json b/site/thor.json index 70522c3..6fcfe8e 100644 --- a/site/thor.json +++ b/site/thor.json @@ -1,5 +1,4 @@ { - "base_url": "https://sbrow.github.io/thor", "date": { "timezone": "America/New_York" },