From 248138f6533e6c7d0e7f2897f5679f482381f193 Mon Sep 17 00:00:00 2001 From: Eric Liu Date: Mon, 16 Sep 2024 13:06:55 -0700 Subject: [PATCH] Add commit hash to the page for better traceability and reference in the Hugo site. --- .gitea/workflows/publish.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitea/workflows/publish.yaml b/.gitea/workflows/publish.yaml index b73d8ed..d254148 100644 --- a/.gitea/workflows/publish.yaml +++ b/.gitea/workflows/publish.yaml @@ -26,6 +26,12 @@ jobs: - name: Build run: hugo --minify + - name: Replace [commit] with short commit hash and hyperlink + run: | + SHORT_COMMIT=$(git rev-parse --short HEAD) + COMMIT_URL="https://git.ericxliu.me/eric/ericxliu-me/commit/$SHORT_COMMIT" + find ./public -type f -exec sed -i "s|\[commit\]|$SHORT_COMMIT|g" {} + + - name: Deploy uses: peaceiris/actions-gh-pages@v4 with: