Zine
Deploying on GitHub Pages
About
This guide assumes that you're already familiar with GitHub Pages. Please refer the official GitHub Pages documentation for more info.
1. Use GitHub Actions
GitHub Actions runner have an inherent overhead and, since Zine is a collection of tools that gets compiled on-demand, your runner will need to do some work that wouldn't be necessary with a single-executable tool.
Luckily, the build will be cached automatically by using mlugg/setup-zig.
This site currently builds in 25-35 seconds, of which 12 are spent setting up Zig, and 2 for the actual site build (the rest is GitHub Pages overhead).
.github/workflows/gh-pages.yml
name: github pages
on:
push:
branches:
- main # Set a branch to deploy
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Change if you need git info
- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- name: Build
run: zig build --summary new
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./zig-out
2. Build locally
A more manual, but faster approach is to build the website locally and commit it to the correct branch/subdir.
Currently Zine doesn't offer any help automating this process, but in the future it might.
Warning
Currently Zine doesn't clean zig-out/
across rebuilds so you will have to do it manually.