fix: upload release assets with correct API endpoint
All checks were successful
Release / build (push) Successful in 11m33s

This commit is contained in:
2026-04-07 09:17:11 +08:00
parent 0b102dcb2a
commit 21e4710829

View File

@@ -41,17 +41,20 @@ jobs:
GITEA_TOKEN: ${{ secrets.release_token }}
run: |
apk add curl
TAG_NAME="${GITHUB_REF#refs/tags/}"
# 创建 Release
curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/yoyo/releases" \
# 创建 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\":\"Automated release\"}")
# 上传产物
RELEASE_ID=$(echo "$RELEASE_RESPONSE" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)
# 上传附件
for f in yoo-* checksums.txt; do
[ -f "$f" ] && curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/yoyo/releases/upload?name=${TAG_NAME}" \
[ -f "$f" ] && curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/yoyo/releases/${RELEASE_ID}/assets" \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@$f"
done