build-image workflow 加 build summary 显式标出源 commit

Gitea Actions UI 顶部显示的 commit 是 workflow 文件所在分支(ci)的
HEAD —— 是 workflow dispatch 的位置,不是镜像实际构建的源代码 commit。
这给用户造成困惑("build 显示的 commit 不是真实 commit")。

新增 Build summary 步骤,always() 触发,写入 GITHUB_STEP_SUMMARY,
让 Action 运行页面 summary 区显式列出:
- 源分支
- 源 commit full SHA
- 源 commit short hash
- 镜像 tag

并附明确警示说明 UI 顶部 commit 不是构建源 commit。

ci/custom 分支保持各自独立的设计不变(meta vs code 分离),仅改进
UI 信息呈现。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-02 18:25:41 +08:00
parent 76043e587b
commit aabc9e29d9
+21 -1
View File
@@ -70,4 +70,24 @@ jobs:
org.opencontainers.image.revision=${{ steps.meta.outputs.full_sha }} org.opencontainers.image.revision=${{ steps.meta.outputs.full_sha }}
tags: | tags: |
git.zhengchentao.win/dev/ezbookkeeping:${{ steps.meta.outputs.image_tag }} git.zhengchentao.win/dev/ezbookkeeping:${{ steps.meta.outputs.image_tag }}
git.zhengchentao.win/dev/ezbookkeeping:latest git.zhengchentao.win/dev/ezbookkeeping:latest
- name: Build summary
# 写入 GITHUB_STEP_SUMMARY 让 Action 运行页面顶部显示真实构建信息。
# workflow 文件在 ci 分支,UI 顶部显示的 commit 是 ci 的 HEADworkflow
# 触发位置),不是被构建的源代码 commit。这一步显式把"实际构建的源代码
# 信息"放到 summary 区,避免误读。always() 保证 build 失败也输出。
if: always()
run: |
{
echo "## Build Summary"
echo ""
echo "| 项 | 值 |"
echo "|---|---|"
echo "| 源分支 | \`${{ inputs.branch }}\` |"
echo "| 源 commit (full) | \`${{ steps.meta.outputs.full_sha }}\` |"
echo "| 源 commit (short) | \`${{ steps.meta.outputs.image_tag }}\` |"
echo "| 镜像 tag | \`git.zhengchentao.win/dev/ezbookkeeping:${{ steps.meta.outputs.image_tag }}\` + \`:latest\` |"
echo ""
echo "> ⚠️ 本次 workflow run 顶部显示的 commit 是 **ci 分支** 上 workflow 文件的 commitdispatch 触发位置),**不是**被构建的源代码 commit。镜像实际构建自上面表格中的源 commit。"
} >> "$GITHUB_STEP_SUMMARY"