fix: use HTTP for uploads, add debug output

- Switch upload URL to HTTP (port 3000) to bypass expired SSL cert
- Add HTTP status code and response body to upload output for debugging
- Upload URL kept in secret (FORGEJO_UPLOAD_URL), not exposed in workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
sanasol
2026-02-26 20:29:26 +01:00
parent c067efbcea
commit 7042188696

View File

@@ -52,12 +52,20 @@ jobs:
run: | run: |
RELEASE_ID=$(curl -s "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \ RELEASE_ID=$(curl -s "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])') -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
echo "Release ID: ${RELEASE_ID}"
echo "Upload URL: ${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets"
for file in dist/*.exe dist/*.exe.blockmap dist/latest.yml; do for file in dist/*.exe dist/*.exe.blockmap dist/latest.yml; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
echo "Uploading $file..." echo "Uploading $file ($(stat -c%s "$file" 2>/dev/null || stat -f%z "$file") bytes)..."
curl -sk --max-time 600 -X POST "${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \ HTTP_CODE=$(curl -w '%{http_code}' --max-time 600 -X POST "${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
-F "attachment=@${file}" || echo "Failed to upload $file" -F "attachment=@${file}" -o /tmp/upload_response.txt 2>/tmp/upload_err.txt)
if [ "$HTTP_CODE" = "201" ]; then
echo "OK — uploaded $(basename $file)"
else
echo "FAILED (HTTP $HTTP_CODE): $(cat /tmp/upload_response.txt)"
echo "Curl stderr: $(cat /tmp/upload_err.txt)"
fi
done done
build-macos: build-macos:
@@ -83,12 +91,19 @@ jobs:
run: | run: |
RELEASE_ID=$(curl -s "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \ RELEASE_ID=$(curl -s "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])') -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
echo "Release ID: ${RELEASE_ID}"
for file in dist/*.dmg dist/*.zip dist/*.blockmap dist/latest-mac.yml; do for file in dist/*.dmg dist/*.zip dist/*.blockmap dist/latest-mac.yml; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
echo "Uploading $file..." echo "Uploading $file..."
curl -sk --max-time 600 -X POST "${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \ HTTP_CODE=$(curl -w '%{http_code}' --max-time 600 -X POST "${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
-F "attachment=@${file}" || echo "Failed to upload $file" -F "attachment=@${file}" -o /tmp/upload_response.txt 2>/tmp/upload_err.txt)
if [ "$HTTP_CODE" = "201" ]; then
echo "OK — uploaded $(basename $file)"
else
echo "FAILED (HTTP $HTTP_CODE): $(cat /tmp/upload_response.txt)"
echo "Curl stderr: $(cat /tmp/upload_err.txt)"
fi
done done
build-linux: build-linux:
@@ -113,10 +128,17 @@ jobs:
run: | run: |
RELEASE_ID=$(curl -s "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \ RELEASE_ID=$(curl -s "${FORGEJO_API}/repos/${GITHUB_REPOSITORY}/releases/tags/${{ github.ref_name }}" \
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])') -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" | python3 -c 'import sys,json; print(json.load(sys.stdin)["id"])')
echo "Release ID: ${RELEASE_ID}"
for file in dist/*.AppImage dist/*.AppImage.blockmap dist/*.deb dist/*.rpm dist/*.pacman dist/latest-linux.yml; do for file in dist/*.AppImage dist/*.AppImage.blockmap dist/*.deb dist/*.rpm dist/*.pacman dist/latest-linux.yml; do
[ -f "$file" ] || continue [ -f "$file" ] || continue
echo "Uploading $file..." echo "Uploading $file ($(stat -c%s "$file" 2>/dev/null || stat -f%z "$file") bytes)..."
curl -sk --max-time 600 -X POST "${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \ HTTP_CODE=$(curl -w '%{http_code}' --max-time 600 -X POST "${FORGEJO_UPLOAD}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets?name=$(basename $file)" \
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
-F "attachment=@${file}" || echo "Failed to upload $file" -F "attachment=@${file}" -o /tmp/upload_response.txt 2>/tmp/upload_err.txt)
if [ "$HTTP_CODE" = "201" ]; then
echo "OK — uploaded $(basename $file)"
else
echo "FAILED (HTTP $HTTP_CODE): $(cat /tmp/upload_response.txt)"
echo "Curl stderr: $(cat /tmp/upload_err.txt)"
fi
done done