diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index ad25f09..d818b95 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -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)