ci: 改进版本信息获取以支持无标签提交

修改所有 GitHub Actions 工作流,在检出代码时获取完整历史记录和标签,并将 `git describe` 命令统一添加 `--always` 参数,确保在无标签的提交上也能生成有效的版本信息。
This commit is contained in:
2026-02-11 09:58:46 +08:00
parent 79f8d5d600
commit 3044db38bb
5 changed files with 19 additions and 13 deletions
+5 -2
View File
@@ -19,10 +19,13 @@ jobs:
steps:
- name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
fetch-tags: true
- name: Save version info
run: |
git describe --tags > VERSION
git describe --tags --always > VERSION
- name: Log in to Docker Hub
uses: docker/login-action@v2
@@ -51,4 +54,4 @@ jobs:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
labels: ${{ steps.meta.outputs.labels }}