fix(cicd): update version dropdown in old releases#97
Conversation
✅ Deploy Preview for docs-projectcapsule ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR restructures the docs deployment so that all release/* branches are built into a single GitHub Pages site with per-version subpaths (/vX.Y/) and a consistent version dropdown across old releases, plus redirects from legacy per-version subdomains.
Changes:
- Add a multi-version build script that discovers
origin/release/X.Ybranches, injects per-version params, and builds each version intopublic/vX.Yplus the latest to the site apex. - Update the GitHub Pages workflow to fetch
release/*refs, pin Hugo to 0.122.0, installyq, and run the multi-version build script. - Add Netlify redirects from
release-0-XX.projectcapsule.devtoprojectcapsule.dev/v0.XX/and introduce arelease/**push-trigger workflow that dispatches the Pages deploy workflow.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| scripts/build-site.sh | New script to build and parameterize all released doc versions into one output tree (apex + /vX.Y/). |
| netlify.toml | Adds redirects from legacy release subdomains to the new /vX.Y/ paths. |
| .github/workflows/hugo.yaml | Pages build now fetches release/*, pins Hugo, installs yq, and runs the multi-version build. |
| .github/workflows/deploy-trigger.yml | Dispatches the Pages deploy workflow on pushes to release/** branches. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| npm ci --no-audit --no-fund >/dev/null 2>&1 \ | ||
| || npm install --no-audit --no-fund >/dev/null 2>&1 || true |
| HUGO_VERSION = "0.145.0" | ||
| HUGO_ENV = "production" | ||
| HUGO_ENABLEGITINFO = "true" | ||
| GO_VERSION = "1.24.1" | ||
| NODE_VERSION = "23.6.0" | ||
| NODE_VERSION = "23.6.0" |
| git worktree add --force --detach "${wt}" \ | ||
| "origin/release/${version}" >/dev/null | ||
| ( |
|
Thanks for your contribution! Nice addition. In this PR, there will be a switch from Netlify to Github Docs when you click on a versioned page. We would like to have everything in Netlify. Sorry for that things weren't as clear; I just opened a new PR to delete all old Hugo/github pages references. |
The problem
Every
release/*branch carries its own hardcodedparams.versionslist, frozen at the point the branch was cut. So if you open an older version, its dropdown only shows the versions that existed back then and the newer releases are missing. The only way to fix an old site's dropdown today is to rebuild that branch by hand, which never happens.There is also no archived banner, that notifies a reader that the current version is outdated.
What this changes
Versioned docs now build from a single workflow onto one GitHub Pages site. Any change on any
release/*branch triggers the build and deployment. Versions are now located at subpaths:/v0.12,/v0.13etc.The deployed website now follows the latest release branch and not main. To deploy the website, the changes must be merged into that release branch.
Netlify keeps handling main and PR previews, and 301-redirects the old
release-0-XXsubdomains to the new subpaths so existing links keep working.Hugo is pinned to 0.122.0 on purpose: that's the version the live sites were actually built with, and newer Hugo dropped the
resources.GetRemote .ErrAPI thatchart-version.htmlrelies on. Upgrading should be done in a separate PR.Rollout (needs doing outside this PR)
Currently the old
release/0.10-0.13branches do not containdeploy-trigger.yml. If we want to backport content, we either have to add that file or trigger the pipeline manually.Testing
Ran the full build on my fork (LorenzBischof/capsule-website): https://lorenzbischof.ch/capsule-website/ Since the deploy previews use Netlify, the version selector uses the versions that are commited to the repository and not the generated versions from the build pipeline.