fix: use formal attachment endpoint for bundle upload

This commit is contained in:
Timi
2026-11-06 23:56:38 +08:00
parent 54a6616b8a
commit e267b26788
+7 -4
View File
@@ -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"