April 17, 2026
Deploy your docs to GitHub Pages
By Phil Scott
Pennington's own docs site needed somewhere to live, and building locally and
copying files up isn't much of a workflow. So there's now a GitHub Actions
workflow that runs the static build and publishes to GitHub Pages on every push
to main — the same workflow any Pennington site can use.
Push to main, your site updates
The workflow wires together two steps. It runs the static build to produce the site, then hands the output folder to GitHub Pages:
on:
push:
branches: [main]
Merge a pull request or push a doc fix, and the published site catches up on its own. Because the static build emits plain HTML, GitHub Pages — which has no .NET runtime — serves it without trouble.
One thing to set up front: GitHub Pages serves project sites from a sub-path
like /my-repo/. Pass that sub-path as the build argument so BaseUrlHtmlRewriter
prefixes internal links and assets under that prefix — CanonicalBaseUrl stays
reserved for absolute canonical and feed links. The GitHub Pages
how-to has the complete workflow file and
the base-URL setup.
Smaller CSS in the workflow
A later follow-up wired PurgeCSS into the same workflow. Pennington generates utility CSS on demand, and PurgeCSS trims the result against the built HTML, so the published site ships only the classes it actually uses. The build job does the trimming — nothing in your project changes.