Skip to content

Commit ea9dceb

Browse files
committed
playground: show the grep build commit and date
The playground version line records the coreutils WASM commit and the site commit, but grep (built as its own standalone WASM module) had no provenance shown. Capture grep's commit/short/date in the workflow and append a UUTILS_GREP_VERSION block to version.js, then render it next to "Built from uutils/coreutils ..." as "grep <short> (<date>)" linking to the uutils/grep commit.
1 parent 77efde6 commit ea9dceb

2 files changed

Lines changed: 19 additions & 0 deletions

File tree

.github/workflows/website.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,19 @@ jobs:
212212
else
213213
echo 'const WASM_COMMANDS = ["grep"];' > "$commands_js"
214214
fi
215+
# Record the grep commit used to build its WASM module so the
216+
# playground can show it alongside the coreutils build.
217+
grep_hash=$(git rev-parse HEAD)
218+
grep_short=$(git rev-parse --short HEAD)
219+
grep_date=$(git show -s --format=%cI HEAD)
220+
{
221+
echo "const UUTILS_GREP_VERSION = {"
222+
echo " commit: \"${grep_hash}\","
223+
echo " short: \"${grep_short}\","
224+
echo " date: \"${grep_date}\""
225+
echo "};"
226+
} >> ../uutils.github.io/static/wasm/version.js
227+
echo "grep WASM build: ${grep_short} (${grep_date})"
215228
fi
216229
217230
- name: Run Zola

content/playground.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ template = "page.html"
5555
parts.push('Built from uutils/coreutils <a href="' + url + '"><code>' +
5656
UUTILS_WASM_VERSION.short + '</code></a> (' + date + ')');
5757
}
58+
if (typeof UUTILS_GREP_VERSION !== "undefined") {
59+
var grepDate = UUTILS_GREP_VERSION.date.split("T")[0];
60+
var grepUrl = "https://github.com/uutils/grep/commit/" + UUTILS_GREP_VERSION.commit;
61+
parts.push('grep <a href="' + grepUrl + '"><code>' +
62+
UUTILS_GREP_VERSION.short + '</code></a> (' + grepDate + ')');
63+
}
5864
if (typeof SITE_VERSION !== "undefined") {
5965
var siteDate = SITE_VERSION.date.split("T")[0];
6066
var siteUrl = "https://github.com/uutils/uutils.github.io/commit/" + SITE_VERSION.commit;

0 commit comments

Comments
 (0)