Show uutils.github.io build commit on the playground page

Alongside the coreutils WASM commit, record the website repo's
commit/date in version.js (SITE_VERSION) and display it next to
the existing build info on the playground.
This commit is contained in:
Sylvestre Ledru
2026-05-29 10:58:06 +02:00
parent c8e78040fe
commit c037b4553e
2 changed files with 28 additions and 7 deletions
+10
View File
@@ -154,14 +154,24 @@ jobs:
commit_hash=$(git rev-parse HEAD)
commit_short=$(git rev-parse --short HEAD)
commit_date=$(git show -s --format=%cI HEAD)
# Record the uutils.github.io commit the site was built from
site_hash=$(git -C ../uutils.github.io rev-parse HEAD)
site_short=$(git -C ../uutils.github.io rev-parse --short HEAD)
site_date=$(git -C ../uutils.github.io show -s --format=%cI HEAD)
{
echo "const UUTILS_WASM_VERSION = {"
echo " commit: \"${commit_hash}\","
echo " short: \"${commit_short}\","
echo " date: \"${commit_date}\""
echo "};"
echo "const SITE_VERSION = {"
echo " commit: \"${site_hash}\","
echo " short: \"${site_short}\","
echo " date: \"${site_date}\""
echo "};"
} > ../uutils.github.io/static/wasm/version.js
echo "uutils WASM build: ${commit_short} (${commit_date})"
echo "site build: ${site_short} (${site_date})"
fi
- name: Run Zola
+18 -7
View File
@@ -44,13 +44,24 @@ template = "page.html"
}).join(" ");
}
}
// Show the uutils commit that was used to build the WASM binary
if (typeof UUTILS_WASM_VERSION !== "undefined") {
var el = document.getElementById("playground-version");
var date = UUTILS_WASM_VERSION.date.split("T")[0];
var url = "https://github.com/uutils/coreutils/commit/" + UUTILS_WASM_VERSION.commit;
el.innerHTML = 'Built from uutils/coreutils <a href="' + url + '"><code>' +
UUTILS_WASM_VERSION.short + '</code></a> (' + date + ')';
// Show the uutils commit that was used to build the WASM binary,
// and the uutils.github.io commit the site itself was built from.
var el = document.getElementById("playground-version");
if (el) {
var parts = [];
if (typeof UUTILS_WASM_VERSION !== "undefined") {
var date = UUTILS_WASM_VERSION.date.split("T")[0];
var url = "https://github.com/uutils/coreutils/commit/" + UUTILS_WASM_VERSION.commit;
parts.push('Built from uutils/coreutils <a href="' + url + '"><code>' +
UUTILS_WASM_VERSION.short + '</code></a> (' + date + ')');
}
if (typeof SITE_VERSION !== "undefined") {
var siteDate = SITE_VERSION.date.split("T")[0];
var siteUrl = "https://github.com/uutils/uutils.github.io/commit/" + SITE_VERSION.commit;
parts.push('site <a href="' + siteUrl + '"><code>' +
SITE_VERSION.short + '</code></a> (' + siteDate + ')');
}
el.innerHTML = parts.join(' &middot; ');
}
});
</script>