Skip to content

Deploy spec site with Hugo and GitHub Actions#221

Merged
horgh merged 3 commits intomainfrom
greg/eng-4271
Feb 25, 2026
Merged

Deploy spec site with Hugo and GitHub Actions#221
horgh merged 3 commits intomainfrom
greg/eng-4271

Conversation

@oschwald
Copy link
Member

@oschwald oschwald commented Feb 24, 2026

Summary

  • Replace the stale gh-pages branch (5 years behind main, broken CDN
    links) with a Hugo site built from the existing MaxMind-DB-spec.md
  • Zero external dependencies — all CSS inlined in the template, no CDN
    links that can break
  • Automated deployment via GitHub Actions on push to main
  • Hover any heading to reveal a # anchor link for deep linking

Preview locally with mise run serve-docs.

Post-merge steps

  1. Apply terraform in mm_website to switch Pages source from
    gh-pages branch to GitHub Actions
  2. Verify the site at https://maxmind.github.io/MaxMind-DB/
  3. Delete the gh-pages branch

Test plan

  • mise run build-docs succeeds with no warnings
  • precious lint --all passes
  • Build job passes in CI (deploy only runs on main)
  • After merge + terraform apply, verify live site renders correctly

🤖 Generated with Claude Code

@gemini-code-assist
Copy link

Summary of Changes

Hello @oschwald, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the project's documentation infrastructure by migrating from a manually maintained gh-pages branch to a modern Hugo-based static site. The change aims to improve maintainability, ensure content freshness, and provide a more robust and self-sufficient deployment mechanism, ultimately enhancing the user experience for accessing project specifications.

Highlights

  • Documentation Site Modernization: Replaced the outdated gh-pages branch with a new documentation site built using Hugo, addressing issues with stale content and broken CDN links.
  • Self-Contained Styling: Ensured the new site has zero external dependencies by inlining all CSS directly within the template, preventing future breakage from external CDN issues.
  • Automated Deployment: Implemented automated deployment of the documentation site via GitHub Actions, triggering on pushes to the main branch.
  • Improved Navigation: Added anchor links to all headings, allowing for easy deep linking to specific sections of the documentation.
  • Local Development Workflow: Introduced mise tasks for setting up, building, and serving the documentation site locally, streamlining the development process.
Changelog
  • .gitignore
    • Added Hugo build artifacts (docs/.hugo_build.lock, docs/content/, docs/public/) to the ignore list.
  • .precious.toml
    • Excluded the docs/content/ directory from linting to prevent issues with Hugo-generated content.
  • docs/hugo.toml
    • Created a new Hugo configuration file.
    • Set the baseURL and title for the documentation site.
    • Disabled Hugo taxonomies.
    • Configured markup.highlight to use github style without classes for code blocks.
  • docs/layouts/_default/_markup/render-heading.html
    • Created a custom HTML template for rendering headings.
    • Implemented logic to add a clickable anchor link (#) next to each heading for deep linking.
  • docs/layouts/_default/default.html
    • Created the main HTML layout template for the Hugo site.
    • Included a <head> section with standard meta tags and the page title.
    • Embedded comprehensive CSS directly within a <style> block to define the site's styling.
    • Structured the <body> to contain a <main> element where page content will be rendered.
  • mise.toml
    • Added hugo = "latest" to the [tools] section.
    • Defined a [tasks.setup-docs] task to prepare the docs directory by creating docs/content and copying MaxMind-DB-spec.md.
    • Defined a [tasks.build-docs] task to build the Hugo site.
    • Defined a [tasks.serve-docs] task to serve the Hugo site locally for development.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/pages.yml
Activity
  • No human activity has occurred on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new documentation site for the MaxMind DB specification, built with Hugo and deployed via GitHub Actions. The changes include adding Hugo configuration, templates, and build tasks. The new site is designed to have zero external dependencies by inlining all CSS. My review found a couple of opportunities to make the new build process more robust and maintainable. I've suggested pinning the Hugo version to ensure reproducible builds and using Hugo's 'mounts' feature for a cleaner way to include the spec file, avoiding unnecessary file copying.

@@ -1,6 +1,26 @@
[tools]
go = "latest"
hugo = "latest"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using latest for the Hugo version can lead to unexpected build failures if a new version of Hugo introduces breaking changes. For better build reproducibility, it's recommended to pin this to a specific version. You can find the latest version on the Hugo releases page.

This also aligns with the repository's general rule about planning for updates when pinning versions, which implies that pinning is the preferred approach over using latest.

Suggested change
hugo = "latest"
hugo = "0.127.0"
References
  1. When pinning tool versions, also establish a plan to keep them up to date. Using 'latest' goes against the principle of reproducible builds, which is what version pinning aims to achieve.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a lockfile.

mise.toml Outdated
Comment on lines 9 to 16
[tasks.setup-docs]
description = "Prepare docs directory for Hugo"
run = """
#!/usr/bin/env bash
set -euo pipefail
mkdir -p docs/content
cp MaxMind-DB-spec.md docs/content/_index.md
"""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Instead of using a shell script to copy the spec file into the docs/content directory, you can use Hugo's module mounts feature. This avoids creating a duplicate file on the filesystem and simplifies the build process.

With this change, you can:

  1. Remove this setup-docs task.
  2. Remove depends = ["setup-docs"] from the build-docs and serve-docs tasks.
  3. Remove docs/content/ from .gitignore and .precious.toml.

Then, add the following to your docs/hugo.toml to mount the file directly:

[module]
  [[module.mounts]]
    source = "MaxMind-DB-spec.md"
    target = "content/_index.md"

According to Hugo's documentation, the source path for a mount is relative to the project root.

oschwald and others added 2 commits February 24, 2026 14:07
Replace the stale gh-pages branch (5 years behind, broken CDN links)
with a Hugo site built from the existing MaxMind-DB-spec.md. Zero
external dependencies — all CSS is inlined in the template.

Design: Charter serif body text, forest-green accents on field-name
headings (node_count, record_size, etc.) with left-border + gradient
for scannability, hover anchor links on all headings for deep linking.

Build with `mise run build-docs`, preview with `mise run serve-docs`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Deploys the Hugo spec site on push to main. Uses the same mise-action
pattern as the precious workflow. All actions are SHA-pinned.

After merge, change the Pages source in repo settings from "Deploy from
a branch" to "GitHub Actions", then delete the gh-pages branch.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The default aqua backend's nested platform-specific directory
structure was not being included in mise env PATH output on
cache misses in CI, causing precious lint to fail.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@horgh horgh merged commit 535644b into main Feb 25, 2026
12 checks passed
@horgh horgh deleted the greg/eng-4271 branch February 25, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants