fix: upload release assets with correct API endpoint
All checks were successful
Release / build (push) Successful in 11m33s
All checks were successful
Release / build (push) Successful in 11m33s
This commit is contained in:
@@ -41,17 +41,20 @@ jobs:
|
|||||||
GITEA_TOKEN: ${{ secrets.release_token }}
|
GITEA_TOKEN: ${{ secrets.release_token }}
|
||||||
run: |
|
run: |
|
||||||
apk add curl
|
apk add curl
|
||||||
|
|
||||||
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
TAG_NAME="${GITHUB_REF#refs/tags/}"
|
||||||
|
|
||||||
# 创建 Release
|
# 创建 Release 并获取 release_id
|
||||||
curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/yoyo/releases" \
|
RELEASE_RESPONSE=$(curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/yoyo/releases" \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
-H "Content-Type: application/json" \
|
-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
|
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}" \
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
-F "attachment=@$f"
|
-F "attachment=@$f"
|
||||||
done
|
done
|
||||||
Reference in New Issue
Block a user