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
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:
@@ -135,9 +135,11 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Upload artifacts (delete existing ones with same name first)
|
# 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")
|
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
|
# Delete existing asset with same name
|
||||||
ASSET_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
ASSET_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
||||||
@@ -147,9 +149,14 @@ jobs:
|
|||||||
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
||||||
fi
|
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 "Authorization: token ${BUILD_TOKEN}" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary "@${file}" \
|
-T "$file" \
|
||||||
"${REPO_API}/releases/${RELEASE_ID}/assets?name=${filename}"
|
"${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
|
done
|
||||||
|
|||||||
@@ -128,9 +128,10 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find artifacts/ -type f -name "*.dmg" | while read file; do
|
find artifacts/ -type f -name "*.dmg" | while IFS= read -r file; do
|
||||||
filename=$(basename "$file")
|
filename=$(basename "$file")
|
||||||
echo "Uploading ${filename}..."
|
encoded_name=$(echo "$filename" | sed 's/ /%20/g')
|
||||||
|
echo "Uploading ${filename} ($(du -h "$file" | cut -f1))..."
|
||||||
|
|
||||||
ASSET_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
ASSET_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \
|
||||||
"${REPO_API}/releases/${RELEASE_ID}/assets" | jq -r ".[] | select(.name == \"${filename}\") | .id // empty")
|
"${REPO_API}/releases/${RELEASE_ID}/assets" | jq -r ".[] | select(.name == \"${filename}\") | .id // empty")
|
||||||
@@ -139,9 +140,10 @@ jobs:
|
|||||||
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
"${REPO_API}/releases/${RELEASE_ID}/assets/${ASSET_ID}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl -s -X POST \
|
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
|
||||||
-H "Authorization: token ${BUILD_TOKEN}" \
|
-H "Authorization: token ${BUILD_TOKEN}" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-H "Content-Type: application/octet-stream" \
|
||||||
--data-binary "@${file}" \
|
-T "$file" \
|
||||||
"${REPO_API}/releases/${RELEASE_ID}/assets?name=${filename}"
|
"${REPO_API}/releases/${RELEASE_ID}/assets?name=${encoded_name}")
|
||||||
|
echo "Upload response: HTTP ${HTTP_CODE}"
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user