Explorar el Código

提取并使用标签名

在工作流中添加了提取标签名的步骤,并更新了发布信息和输出以使用提取到的标签名,确保发布的版本信息准确无误。
SongZihuan hace 1 semana
padre
commit
674407f84a
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. 9 2
      .github/workflows/go-tag-release.yml

+ 9 - 2
.github/workflows/go-tag-release.yml

@@ -94,6 +94,13 @@ jobs:
         with:
         with:
           fetch-depth: 0 # 获取所有历史记录以便能够创建标签
           fetch-depth: 0 # 获取所有历史记录以便能够创建标签
 
 
+      - name: Extract tag name
+        id: extract_tag
+        run: |
+          # 提取标签名
+          TAG_NAME=$(echo "${GITHUB_REF}" | sed 's/refs\/tags\///')
+          echo "tag=${TAG_NAME}" >> $GITHUB_OUTPUT
+
       - name: Download artifact
       - name: Download artifact
         uses: actions/download-artifact@v4
         uses: actions/download-artifact@v4
         with:
         with:
@@ -111,7 +118,7 @@ jobs:
           artifactErrorsFailBuild: true
           artifactErrorsFailBuild: true
           allowUpdates: false
           allowUpdates: false
           body: |
           body: |
-            新版本 ${{  github.ref  }} 发布啦!
+            新版本 ${{  steps.extract_tag.outputs.tag  }} 发布啦!
             快来体验吧!
             快来体验吧!
           generateReleaseNotes: true
           generateReleaseNotes: true
           makeLatest: "legacy"
           makeLatest: "legacy"
@@ -120,5 +127,5 @@ jobs:
       - name: Output the URL of the new release
       - name: Output the URL of the new release
         run: echo "The release is available at ${{ steps.create_release.outputs.html_url }}"
         run: echo "The release is available at ${{ steps.create_release.outputs.html_url }}"
     outputs:
     outputs:
-      tag: "${{  github.ref  }}"
+      tag: "${{  steps.extract_tag.outputs.tag  }}"
       release: "${{ steps.create_release.outputs.html_url }}"
       release: "${{ steps.create_release.outputs.html_url }}"