feat: release 自动使用 tag 注释作为 Release 说明
All checks were successful
Release / build (push) Successful in 6m27s

This commit is contained in:
2026-04-08 02:30:33 +08:00
parent 5b7475860a
commit e6ff8a887c

View File

@@ -42,15 +42,18 @@ jobs:
env:
GITEA_TOKEN: ${{ secrets.release_token }}
run: |
apk add curl
apk add curl jq
TAG_NAME="${GITHUB_REF#refs/tags/}"
# 获取 tag 注释或 commit message 作为 release 说明
RELEASE_BODY=$(git tag -l --format='%(contents)' "$TAG_NAME" 2>/dev/null || git log -1 --format="%s%n%n%b" "$TAG_NAME" 2>/dev/null || echo "Release $TAG_NAME")
# 创建 Release 并获取 release_id
RELEASE_RESPONSE=$(curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/yoyo/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"Automated release\"}")
-d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"${RELEASE_BODY}\"}")
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)