It would be nice to have a turnkey solution for projects that wish to support versioned documentation.
Requirements
Table stakes
Nice to have
Extra credit
Prior art
http4s
The /docs directory on live branches publishes to a subdirectory of the gh-pages branch. The /website directory is published off main and contains the project information that pertains to all branches.
Because each branch publishes independently, there is no way to update the theme across the board, nor a way to automatically update the version selector on old branches when release statuses change. Care must be taken to not touch anything outside that subdirectory.
cats-effect
I don't know how it works. Submodules and stuff. Generates crufty PRs, but the end user experience is best-in-Typelevel.
Monix
Has also been doing it for years in an artisanal fashion.
Other Scala projects that do a nice job and are worth studying
Other tooling
Laika has multiple version support, and sbt-typelevel already integrates Laika
Other ideas
All of these are based on the idea that the site generator runs once, instead of independent sites per version and for the common area. This raises a basic tradeoff:
- If the site generator runs in the CI of a branch, we have a race condition
- If the site generator is triggered by a workflow after a branch is merged, that branch can break the site
Publish mdocs per branch, separate job generates the site
Requires careful git exclusions. Is the most economical with CI time.
mdoc all the branches and generate the site in one job
Awfully slow for large projects.
Parallelize building all branches, upload artifacts, generate in separate job
It's a heavy build, but it avoids git exclusions
It would be nice to have a turnkey solution for projects that wish to support versioned documentation.
Requirements
Table stakes
Nice to have
Extra credit
/stable/*redirects to the latest stable version, like Read The Docs. This was possible on Netlify, which is an administrative headache. This is impossible on gh-pages.Prior art
http4s
The
/docsdirectory on live branches publishes to a subdirectory of the gh-pages branch. The/websitedirectory is published off main and contains the project information that pertains to all branches.Because each branch publishes independently, there is no way to update the theme across the board, nor a way to automatically update the version selector on old branches when release statuses change. Care must be taken to not touch anything outside that subdirectory.
cats-effect
I don't know how it works. Submodules and stuff. Generates crufty PRs, but the end user experience is best-in-Typelevel.
Monix
Has also been doing it for years in an artisanal fashion.
Other Scala projects that do a nice job and are worth studying
Other tooling
Laika has multiple version support, and sbt-typelevel already integrates Laika
Other ideas
All of these are based on the idea that the site generator runs once, instead of independent sites per version and for the common area. This raises a basic tradeoff:
Publish mdocs per branch, separate job generates the site
Requires careful git exclusions. Is the most economical with CI time.
mdoc all the branches and generate the site in one job
Awfully slow for large projects.
Parallelize building all branches, upload artifacts, generate in separate job
It's a heavy build, but it avoids git exclusions