diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index b28e385..9f9743e 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -105,25 +105,28 @@ jobs: env: API_BASE_URL: ${{ vars.TIMI_API_BASE_URL }} API_TOKEN: ${{ secrets.TIMI_API_TOKEN }} + VERSION: ${{ steps.version.outputs.version }} run: | if [ -z "$API_BASE_URL" ] || [ -z "$API_TOKEN" ]; then echo "FAIL: 缺少 vars.TIMI_API_BASE_URL 或 secrets.TIMI_API_TOKEN" exit 1 fi - response=$(curl -sS -X POST "$API_BASE_URL/attachment/temp/upload" \ + response=$(curl -sS -X POST "$API_BASE_URL/attach/create" \ -H "Token: $API_TOKEN" \ + -F "bizType=APP_RELEASE" \ + -F "name=bundle-$VERSION.zip" \ -F "file=@bundle.zip") echo "响应:$response" attachment_id=$(echo "$response" | node -e " let s = ''; process.stdin.on('data', d => s += d).on('end', () => { const body = JSON.parse(s); - const list = Array.isArray(body) ? body : (body.data || []); - if (!list.length || !list[0].id) { + const data = body.data || body; + if (!data.id) { console.error('未取到附件 ID'); process.exit(1); } - process.stdout.write(list[0].id); + process.stdout.write(data.id); }); ") echo "附件 ID:$attachment_id"