Download links stay on the release the documentation was built for

The download pages and the landing page were rendered with links for `release`, but the page
script then repointed every button at the newest Gitea release, so a later release candidate
would have moved the 1.0.0 documentation's links. The script now looks up the release tagged
with the page's own version (releases/tags/<version>); if it is not published, the built-in
links stand. The install examples name 1.0.0 instead of an rc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqXYdJDrM65gxsCn2PrbfK
This commit is contained in:
leonarski_fandClaude Opus 5.5 committed 2026-11-15 17:01:47 +01:00
1 parent c695c45c6e
commit 121e26ceae
6 files changed
+17 -17

No files matched your search

+1 -1
View File
@@ -48,7 +48,7 @@ Rugnux is one executable in an archive on the release page,
it into a directory of its own. On Linux x86-64, with or without an NVIDIA GPU:
```
VERSION=1.0.0-rc.184 # the newest release on the page
VERSION=1.0.0
curl -L -O https://gitea.psi.ch/mx/jungfraujoch/releases/download/$VERSION/rugnux-$VERSION-linux-x86_64-cuda12.tgz
mkdir -p rugnux-$VERSION && tar xzf rugnux-$VERSION-linux-x86_64-cuda12.tgz -C rugnux-$VERSION
export PATH=$PWD/rugnux-$VERSION/bin:$PATH
+1 -1
View File
@@ -53,7 +53,7 @@ Rugnux is one executable in an archive on the release page, https://gitea.psi.ch
On Linux x86-64 (the other platforms are on [Download](RUGNUX_DOWNLOAD.md)):
```
VERSION=1.0.0-rc.184
VERSION=1.0.0
curl -L -O https://gitea.psi.ch/mx/jungfraujoch/releases/download/$VERSION/rugnux-$VERSION-linux-x86_64-cuda12.tgz
mkdir -p rugnux-$VERSION && tar xzf rugnux-$VERSION-linux-x86_64-cuda12.tgz -C rugnux-$VERSION
export PATH=$PWD/rugnux-$VERSION/bin:$PATH
+1 -1
View File
@@ -40,7 +40,7 @@ release page:
give `tar` a destination of its own, or it will scatter those into whatever directory you are in:
```
VERSION=1.0.0-rc.184 # the newest release on the page
VERSION=1.0.0
curl -L -O https://gitea.psi.ch/mx/jungfraujoch/releases/download/$VERSION/rugnux-$VERSION-linux-x86_64-cuda12.tgz
mkdir -p /opt/rugnux-$VERSION
tar xzf rugnux-$VERSION-linux-x86_64-cuda12.tgz -C /opt/rugnux-$VERSION
+2 -2
View File
@@ -7,8 +7,8 @@
archive. Every link is built from the version Sphinx was configured with (``release`` in
docs/conf.py, which update_version.sh rewrites from VERSION), so no version string on the page is
maintained by hand. The page's script (_static/jfjoch_downloads.js) then asks the Gitea API for the
newest published release and repoints the buttons at its assets - so a docs build older or newer
than the current release still offers the archives that exist, and says which ones do not.
release tagged with that same version and checks the buttons against its assets (URL, size, and
which platforms it lacks); later releases never move the links.
The asset names follow CPack's naming in CMakeLists.txt; the regular expressions are what the
script matches against the release's asset list, written loosely enough to survive a CUDA major
+11 -11
View File
@@ -1,23 +1,24 @@
// SPDX-FileCopyrightText: 2026 Filip Leonarski, Paul Scherrer Institute <filip.leonarski@psi.ch>
// SPDX-License-Identifier: GPL-3.0-only
// Download pages: repoint the buttons at the newest published release.
// Download pages: check the buttons against the release the documentation was built for.
//
// The page is rendered with links for the version the documentation was built for
// (docs/_ext/jfjoch_downloads.py). That version may not be released yet, or may be behind the
// current release, so once the page is up this asks the Gitea API (anonymous, CORS-enabled) for
// the newest non-draft release and rewrites each button from that release's asset list: the
// matching asset's URL and size, or "not part of this release" where the platform has none.
// Without network access, or if the API answers anything but 200, the built-in links stand.
// The page is rendered with links for that version (docs/_ext/jfjoch_downloads.py). Once the page
// is up this asks the Gitea API (anonymous, CORS-enabled) for the release tagged with exactly that
// version - never the newest one, so later releases do not move the links - and rewrites each
// button from its asset list: the matching asset's URL and size, or "not part of this release"
// where the platform has none. Without network access, or if the API answers anything but 200
// (the release is not published yet), the built-in links stand.
(function main() {
// Sphinx puts html_js_files into <head>, before the page's body exists.
if (document.readyState === "loading") {
document.addEventListener("DOMContentLoaded", main);
return;
}
var API = "https://gitea.psi.ch/api/v1/repos/mx/jungfraujoch/releases?limit=10";
var blocks = document.querySelectorAll(".jfj-dl");
if (!blocks.length || !window.fetch) return;
var version = blocks[0].querySelector("[data-jfj=version]").textContent;
var API = "https://gitea.psi.ch/api/v1/repos/mx/jungfraujoch/releases/tags/" + encodeURIComponent(version);
function megabytes(bytes) {
return (bytes / 1048576).toFixed(bytes < 10485760 ? 1 : 0) + " MB";
@@ -50,9 +51,8 @@
fetch(API)
.then(function (r) { return r.ok ? r.json() : Promise.reject(r.status); })
.then(function (releases) {
var release = releases.filter(function (r) { return !r.draft && r.assets; })[0];
if (release) apply(release);
.then(function (release) {
if (!release.draft && release.assets) apply(release);
})
.catch(function () { /* offline or API unavailable: the built-in links stand */ });
})();
+1 -1
View File
@@ -71,7 +71,7 @@ mathjax3_config = {
html_theme = 'sphinx_material'
html_static_path = ['../broker/redoc-static.html', '_static']
# The home page's program cards and the download pages' buttons (docs/_static); the script asks
# the Gitea API for the newest release and repoints the download buttons at its assets.
# the Gitea API for the release of this `release` version and checks the buttons against its assets.
html_css_files = ['jfjoch.css']
html_js_files = ['jfjoch_downloads.js']
#html_theme_options = {