Fix release upload: use streaming upload and handle spaces in filenames
Some checks failed
Build Linux / Build app (Linux) (push) Has been cancelled
Build Linux / Release (Linux) (push) Has been cancelled
Build Linux / Build sidecar (Linux) (push) Has been cancelled
Build macOS / Build app (macOS) (push) Has been cancelled
Build macOS / Release (macOS) (push) Has been cancelled
Build Windows / Build app (Windows) (push) Has been cancelled
Build Windows / Release (Windows) (push) Has been cancelled
Build macOS / Build sidecar (macOS) (push) Has been cancelled
Build Windows / Build sidecar (Windows) (push) Has been cancelled

- Use curl -T (streaming) instead of --data-binary (loads into memory)
  to handle large .deb/.AppImage files
- URL-encode spaces in filenames for the Gitea API
- Use IFS= read -r to handle filenames with spaces
- Add HTTP status code logging for upload debugging

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-21 05:53:57 -07:00
parent f023bf02a9
commit a3c39a2069
2 changed files with 19 additions and 10 deletions

View File

@@ -135,9 +135,11 @@ jobs:
fi
# Upload artifacts (delete existing ones with same name first)
find artifacts/ -type f \( -name "*.deb" -o -name "*.AppImage" \) | while read file; do
find artifacts/ -type f \( -name "*.deb" -o -name "*.AppImage" \) | while IFS= read -r file; do
filename=$(basename "$file")
echo "Uploading ${filename}..."
# URL-encode spaces in filename for the API
encoded_name=$(echo "$filename" | sed 's/ /%20/g')
echo "Uploading ${filename} ($(du -h "$file" | cut -f1))..."
# Delete existing asset with same name
ASSET_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
@@ -147,9 +149,14 @@ jobs:
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
fi
curl -s -X POST \
# Upload using -T for streaming (avoids loading entire file into memory)
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Authorization: token ${BUILD_TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary "@${file}" \
"${REPO_API}/releases/${RELEASE_ID}/assets?name=${filename}"
-T "$file" \
"${REPO_API}/releases/${RELEASE_ID}/assets?name=${encoded_name}")
echo "Upload response: HTTP ${HTTP_CODE}"
if [ "$HTTP_CODE" -ge 400 ]; then
echo "WARNING: Upload failed for ${filename}"
fi
done