Deploy to GitHub Pages: Fumadocs latest + Sphinx-built legacy versions - #3
Merged
Merged
Conversation
deploy.yml publishes the whole site to GitHub Pages on pushes to main, a daily cron, and a docs-updated repository_dispatch: - /en/latest is the Fumadocs build of sqlc-dev/sqlc@main, as before. - Every tag the old Read the Docs site served (v1.7.0..v1.31.1, frozen in legacy-versions.json) is rebuilt with Sphinx from that tag's own docs/ and fully pinned requirements.txt, so /en/vX.Y.Z/ URLs keep resolving. The immutable HTML is cached per tag; a miss rebuilds in ~2 minutes. - scripts/assemble-site.mjs stitches the artifacts into one tree and injects, into every legacy page, an "older release" banner plus a search-engine hint in the docs.djangoproject.com style: rel=canonical to the same path under /en/latest when it still exists there, noindex when it does not. It also generates /en/stable redirect stubs (RTD's newest-release alias), versions.json for the version switcher, and a 404 page. Any missing snapshot fails the deploy loudly. - components/version-banner.tsx bakes the same banner into future Fumadocs-built versioned snapshots (any NEXT_PUBLIC_BASE_PATH other than /en/latest). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014SnbcV34MHXfFMKSiAjkLY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Wires up deployment:
deploy.ymlbuilds the whole site and publishes it to GitHub Pages on pushes to main, a daily cron, arepository_dispatch(docs-updated), and manual dispatch.What gets deployed
/en/latest/— the Fumadocs build ofsqlc-dev/sqlc@maindocs, as CI already builds it (out/plus theout-root/domain-root redirects;out-segments/is not deployable on a filesystem host and the client falls back to full-page payloads, per the README)./en/vX.Y.Z/— every version the old Read the Docs site serves (v1.7.0 through v1.31.1, per the RTD API), rebuilt with Sphinx from that tag's owndocs/and fully pinnedrequirements.txt— exactly as RTD built it — so URLs likedocs.sqlc.dev/en/v1.31.1/keep resolving. The list is frozen inlegacy-versions.json; future releases are Fumadocs-built and never go in it. Both the oldest (Sphinx 3.4.3) and newest (8.2.3) toolchains were verified to build cleanly on Python 3.11. Snapshots are immutable, so each tag's built HTML is cached (actions/cache); a miss rebuilds in ~2 minutes, andCACHE_EPOCHforces a full rebuild./en/stable/— RTD's newest-release alias, generated as redirect stubs mirroring the newest snapshot's page tree./,/en/redirects, a regeneratedversions.json(drives the version-switcher dropdown), and a404.html.Older-version treatment
scripts/assemble-site.mjsinjects into every legacy Sphinx page:/en/latest/(inserted after the theme's<div role="main">, which is present and unique across all sphinx_rtd_theme versions in range; rediraffe redirect stubs are skipped);rel=canonicalto the same path under/en/latest/when that page still exists there (old inbound links keep passing ranking signal to the current docs),noindexwhen it doesn't (genindex.html,search.html, removed pages) — so old releases never show up in search results.components/version-banner.tsxbakes the same banner into any future Fumadocs-built versioned snapshot (anyNEXT_PUBLIC_BASE_PATHother than/en/latest); those already setnoindexat build time.A missing snapshot fails the deploy loudly rather than silently dropping published URLs.
Tested
versions.json.NEXT_PUBLIC_BASE_PATH=/en/v9.9.9build renders the in-app banner and noindex.npm run types:checkpasses; both workflow YAMLs parse.One-time setup for cutover
Settings → Pages → source "GitHub Actions", custom domain
docs.sqlc.dev; then point the DNS record at GitHub Pages instead of Read the Docs. Still to be added upstream: a small workflow in sqlc-dev/sqlc that sends thedocs-updateddispatch on pushes tomaintouchingdocs/**.🤖 Generated with Claude Code
https://claude.ai/code/session_014SnbcV34MHXfFMKSiAjkLY
Generated by Claude Code