fix: use environment variable to pass full tag message to GoReleaser

- Extract complete tag message body in workflow using git format
- Pass tag message via TAG_MESSAGE environment variable
- Update goreleaser config to use .Env.TAG_MESSAGE instead of .TagBody
- Fix release notes being truncated to first paragraph only
This commit is contained in:
shaw
2025-12-18 15:30:35 +08:00
parent e63d95122a
commit 882c2e1eef
2 changed files with 14 additions and 5 deletions

View File

@@ -85,6 +85,16 @@ jobs:
go-version: '1.24'
cache-dependency-path: backend/go.sum
- name: Get tag message
id: tag_message
run: |
# 获取完整的 tag message跳过第一行标题
TAG_MESSAGE=$(git tag -l --format='%(contents:body)' ${GITHUB_REF#refs/tags/})
# 使用 EOF 分隔符处理多行内容
echo "message<<EOF" >> $GITHUB_OUTPUT
echo "$TAG_MESSAGE" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
@@ -92,6 +102,7 @@ jobs:
args: release --clean --skip=validate
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_MESSAGE: ${{ steps.tag_message.outputs.message }}
# ===========================================================================
# Docker Build and Push

View File

@@ -56,14 +56,12 @@ release:
name: sub2api
draft: false
prerelease: auto
name_template: "v{{.Version}}"
# 完全使用 tag 消息作为 release 内容
name_template: "Sub2API {{.Version}}"
# 完全使用 tag 消息作为 release 内容(通过环境变量传入)
header: |
## Sub2API {{.Version}}
> AI API Gateway Platform - 将 AI 订阅配额分发和管理
{{ .TagBody }}
{{ .Env.TAG_MESSAGE }}
footer: |