From 052728c168ae8243c803db57545f9b2d4f601c44 Mon Sep 17 00:00:00 2001 From: Giancarmine Salucci Date: Sun, 24 May 2026 16:44:15 +0200 Subject: [PATCH] ci: use github.token for package upload (respects permissions:packages:write), fix curl status capture --- .gitea/workflows/android-build.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/android-build.yml b/.gitea/workflows/android-build.yml index 27df0da..d302609 100644 --- a/.gitea/workflows/android-build.yml +++ b/.gitea/workflows/android-build.yml @@ -96,7 +96,7 @@ jobs: # ── 9. Publish to Gitea generic package registry ───────────────────────── - name: Publish APKs to Gitea package registry env: - TOKEN: ${{ secrets.GITEA_TOKEN }} + TOKEN: ${{ github.token }} run: | set -euo pipefail VERSION="${{ github.run_number }}" @@ -105,13 +105,20 @@ jobs: upload() { local src="$1" dst_name="$2" echo "→ Uploading $dst_name (version $VERSION)…" - HTTP=$(curl --silent --show-error --write-out "%{http_code}" \ + # --output /dev/null discards the body; --write-out captures only the 3-digit code + HTTP=$(curl --silent --show-error \ + --output /dev/null --write-out "%{http_code}" \ -X PUT \ -H "Authorization: token $TOKEN" \ --upload-file "$src" \ "$BASE/$VERSION/$dst_name") if [[ "$HTTP" != "20"* ]]; then echo "✗ Upload failed — HTTP $HTTP" + # Retry once with verbose output for diagnostics + curl -v -X PUT \ + -H "Authorization: token $TOKEN" \ + --upload-file "$src" \ + "$BASE/$VERSION/$dst_name" 2>&1 | tail -30 || true exit 1 fi echo "✓ $dst_name → $BASE/$VERSION/$dst_name"