Skip to content

Deploy docs site with Hugo via GitHub Actions#257

Open
oschwald wants to merge 3 commits into
mainfrom
greg/stf-448
Open

Deploy docs site with Hugo via GitHub Actions#257
oschwald wants to merge 3 commits into
mainfrom
greg/stf-448

Conversation

@oschwald
Copy link
Copy Markdown
Member

Summary

Migrates the Pages index from Jekyll on gh-pages to a Hugo build that
publishes back onto gh-pages from GitHub Actions. All CSS is now
inlined in the layout template — no external CDN dependencies.

  • Hugo site lives under docs/ on main and mounts README.md as the
    home page
  • A small pill nav links from the overview to the phpDocumentor output
    at /doc/latest/
  • .github/workflows/pages.yml builds with mise run build-docs and
    pushes to gh-pages via peaceiris/actions-gh-pages with
    keep_files: true, so every /doc/vX.Y.Z/ subtree stays untouched
  • dev-bin/release.sh no longer regenerates the Jekyll index.md;
    the phpDocumentor-publishing block is unchanged

Same design as MaxMind-DB PR #221.

For STF-448.

Post-merge steps

  1. Verify the live site at https://maxmind.github.io/minfraud-api-php/
    and a sample /doc/latest/ still loads after the next workflow run
  2. In a separate commit on gh-pages, drop the legacy Jekyll source
    files

Pages source stays on gh-pages — no Terraform change for this repo.

Test plan

  • mise run build-docs succeeds with no warnings
  • Rendered <title>, <h1>, and pill nav are correct
  • No static-gh.maxmind.com references in the new site
  • Build job passes in CI (push step only runs on main)
  • After merge, confirm the workflow pushes successfully to gh-pages
    and /doc/vX.Y.Z/ subtrees are preserved

🤖 Generated with Claude Code

oschwald and others added 3 commits May 15, 2026 22:44
Build with `mise run build-docs`, preview with `mise run serve-docs`.

The site mounts the existing `README.md` as the home page so the source
of truth stays in one place. A small pill nav links from Overview to
the versioned API documentation that lives on the `gh-pages` branch
under `doc/latest/`.

CSS is inlined in the layout template — no external dependencies. Same
Charter serif + forest-green design as the MaxMind-DB spec site.

For STF-448.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deploys the Hugo docs site on push to main. The workflow builds the
site with `mise run build-docs` and pushes the rendered output onto
the existing `gh-pages` branch with `keep_files: true` — that
preserves every `/doc/vX.Y.Z/` phpDocumentor subtree exactly as the
release script publishes them. Pages keeps deploying from `gh-pages`,
so no Terraform change is needed for this repo.

All actions are SHA-pinned.

For STF-448.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Hugo on `main` now owns the Pages index, so the release script no
longer needs to write a Jekyll front-matter wrapper around README.md
on the gh-pages branch. The phpDocumentor block that builds and
publishes `doc/$tag/` is unchanged — that versioned tree continues to
live on gh-pages and is preserved by the new workflow's
`keep_files: true`.

For STF-448.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@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 migrates the project's documentation system to Hugo, replacing a manual script that generated the index page from the README. It introduces a new Hugo configuration, layouts, and mise tasks for building and serving the documentation site. Feedback includes improving accessibility by adding aria-current="page" to active navigation links and ensuring the local development server uses a consistent base URL to prevent broken links.

</head>
<body>
<nav class="page-nav">
<a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>Overview</a>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For better accessibility, add aria-current="page" to the active navigation link. This helps screen reader users identify the current page within the navigation menu.

Suggested change
<a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active"{{ end }}>Overview</a>
<a href="{{ .Site.Home.RelPermalink }}"{{ if .IsHome }} class="active" aria-current="page"{{ end }}>Overview</a>

Comment thread mise.toml

[tasks.serve-docs]
description = "Serve the docs site locally with Hugo dev server"
run = "hugo server --source docs"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The "API documentation" link in the template uses relURL, which prepends the path from the production baseURL (e.g., /minfraud-api-php/). When running the dev server locally, this link will be broken unless the server is configured with the same base path. Adding the --baseURL flag ensures the local development environment matches the production path structure.

Suggested change
run = "hugo server --source docs"
run = "hugo server --source docs --baseURL http://localhost/minfraud-api-php/"

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.

1 participant