From 5ad1993fee7d127b1af776e5816497169be24e14 Mon Sep 17 00:00:00 2001 From: infinitycat Date: Sat, 10 May 2025 02:11:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96Docker=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E6=9E=84=E5=BB=BA=E6=B5=81=E7=A8=8B=EF=BC=8C=E5=A2=9E?= =?UTF-8?q?=E5=BC=BA=E6=A0=87=E7=AD=BE=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BB=A5=E6=94=AF=E6=8C=81=E9=BB=98=E8=AE=A4=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-image.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 7ea9d86e7..a2e4cfc83 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -149,6 +149,20 @@ jobs: - name: Inspect image run: | - tags_json='${{ needs.prepare.outputs.tags }}' - first_tag=$(echo $tags_json | jq -r '.tags[0]') - docker buildx imagetools inspect $first_tag \ No newline at end of file + # 使用默认标签 + DEFAULT_TAG="${{ env.REGISTRY_IMAGE }}:latest" + + # 尝试从 prepare 输出中获取标签 + if [ -n "${{ needs.prepare.outputs.tags }}" ]; then + TAGS_JSON='${{ needs.prepare.outputs.tags }}' + FIRST_TAG=$(echo $TAGS_JSON | jq -r '.tags[0]') + if [ -n "$FIRST_TAG" ] && [ "$FIRST_TAG" != "null" ]; then + echo "使用从 metadata 获取的标签: $FIRST_TAG" + docker buildx imagetools inspect $FIRST_TAG + exit 0 + fi + fi + + # 如果没有标签或提取失败,使用默认标签 + echo "使用默认标签: $DEFAULT_TAG" + docker buildx imagetools inspect $DEFAULT_TAG \ No newline at end of file