Skip to content

Commit c037b45

Browse files
committed
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.
1 parent c8e7804 commit c037b45

2 files changed

Lines changed: 28 additions & 7 deletions

File tree

.github/workflows/website.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,24 @@ jobs:
154154
commit_hash=$(git rev-parse HEAD)
155155
commit_short=$(git rev-parse --short HEAD)
156156
commit_date=$(git show -s --format=%cI HEAD)
157+
# Record the uutils.github.io commit the site was built from
158+
site_hash=$(git -C ../uutils.github.io rev-parse HEAD)
159+
site_short=$(git -C ../uutils.github.io rev-parse --short HEAD)
160+
site_date=$(git -C ../uutils.github.io show -s --format=%cI HEAD)
157161
{
158162
echo "const UUTILS_WASM_VERSION = {"
159163
echo " commit: \"${commit_hash}\","
160164
echo " short: \"${commit_short}\","
161165
echo " date: \"${commit_date}\""
162166
echo "};"
167+
echo "const SITE_VERSION = {"
168+
echo " commit: \"${site_hash}\","
169+
echo " short: \"${site_short}\","
170+
echo " date: \"${site_date}\""
171+
echo "};"
163172
} > ../uutils.github.io/static/wasm/version.js
164173
echo "uutils WASM build: ${commit_short} (${commit_date})"
174+
echo "site build: ${site_short} (${site_date})"
165175
fi
166176
167177
- name: Run Zola

content/playground.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,24 @@ template = "page.html"
4444
}).join(" ");
4545
}
4646
}
47-
// Show the uutils commit that was used to build the WASM binary
48-
if (typeof UUTILS_WASM_VERSION !== "undefined") {
49-
var el = document.getElementById("playground-version");
50-
var date = UUTILS_WASM_VERSION.date.split("T")[0];
51-
var url = "https://github.com/uutils/coreutils/commit/" + UUTILS_WASM_VERSION.commit;
52-
el.innerHTML = 'Built from uutils/coreutils <a href="' + url + '"><code>' +
53-
UUTILS_WASM_VERSION.short + '</code></a> (' + date + ')';
47+
// Show the uutils commit that was used to build the WASM binary,
48+
// and the uutils.github.io commit the site itself was built from.
49+
var el = document.getElementById("playground-version");
50+
if (el) {
51+
var parts = [];
52+
if (typeof UUTILS_WASM_VERSION !== "undefined") {
53+
var date = UUTILS_WASM_VERSION.date.split("T")[0];
54+
var url = "https://github.com/uutils/coreutils/commit/" + UUTILS_WASM_VERSION.commit;
55+
parts.push('Built from uutils/coreutils <a href="' + url + '"><code>' +
56+
UUTILS_WASM_VERSION.short + '</code></a> (' + date + ')');
57+
}
58+
if (typeof SITE_VERSION !== "undefined") {
59+
var siteDate = SITE_VERSION.date.split("T")[0];
60+
var siteUrl = "https://github.com/uutils/uutils.github.io/commit/" + SITE_VERSION.commit;
61+
parts.push('site <a href="' + siteUrl + '"><code>' +
62+
SITE_VERSION.short + '</code></a> (' + siteDate + ')');
63+
}
64+
el.innerHTML = parts.join(' &middot; ');
5465
}
5566
});
5667
</script>

0 commit comments

Comments
 (0)