From a662ecc14be20d8f5c89efb9282d8979bc39c3f0 Mon Sep 17 00:00:00 2001 From: jackfiled Date: Fri, 28 Mar 2025 13:44:00 +0800 Subject: [PATCH] feat: add build commit id in footer. --- .gitea/workflows/build.yaml | 2 +- YaeBlog/Components/Foonter.razor | 10 +++++++++- YaeBlog/Dockerfile | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 15958d6..aa2bfde 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -18,7 +18,7 @@ jobs: - name: Build docker image run: | cd YaeBlog - podman build . -t registry.cn-beijing.aliyuncs.com/jackfiled/blog:latest + podman build . -t registry.cn-beijing.aliyuncs.com/jackfiled/blog:latest --build-arg COMMIT_ID=$(git rev-parse --short=10 HEAD) - name: Workaround to make sure podman login succeed run: | mkdir /root/.docker diff --git a/YaeBlog/Components/Foonter.razor b/YaeBlog/Components/Foonter.razor index 8a5935b..6318f05 100644 --- a/YaeBlog/Components/Foonter.razor +++ b/YaeBlog/Components/Foonter.razor @@ -7,11 +7,15 @@ 驱动。

+

+ Build Commit # + +

- 蜀ICP备2022004429号-1 +

@@ -19,4 +23,8 @@ @code { private string DotnetVersion => $".NET {Environment.Version}"; + + private string BuildCommitId => Environment.GetEnvironmentVariable("COMMIT_ID") ?? "local_build"; + + private string BuildCommitUrl => $"https://git.rrricardo.top/jackfiled/YaeBlog/commit/{BuildCommitId}"; } diff --git a/YaeBlog/Dockerfile b/YaeBlog/Dockerfile index 8883495..fc49c56 100644 --- a/YaeBlog/Dockerfile +++ b/YaeBlog/Dockerfile @@ -1,5 +1,8 @@ FROM mcr.microsoft.com/dotnet/aspnet:9.0 +ARG COMMIT_ID +ENV COMMIT_ID=${COMMIT_ID} + WORKDIR /app COPY bin/Release/net9.0/publish/ ./ COPY source/ ./source/