ci: use github.token for package upload (respects permissions:packages:write), fix curl status capture
Some checks failed
Android Build & Publish / android (push) Failing after 1m56s
Some checks failed
Android Build & Publish / android (push) Failing after 1m56s
This commit is contained in:
@@ -96,7 +96,7 @@ jobs:
|
|||||||
# ── 9. Publish to Gitea generic package registry ─────────────────────────
|
# ── 9. Publish to Gitea generic package registry ─────────────────────────
|
||||||
- name: Publish APKs to Gitea package registry
|
- name: Publish APKs to Gitea package registry
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
TOKEN: ${{ github.token }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
VERSION="${{ github.run_number }}"
|
VERSION="${{ github.run_number }}"
|
||||||
@@ -105,13 +105,20 @@ jobs:
|
|||||||
upload() {
|
upload() {
|
||||||
local src="$1" dst_name="$2"
|
local src="$1" dst_name="$2"
|
||||||
echo "→ Uploading $dst_name (version $VERSION)…"
|
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 \
|
-X PUT \
|
||||||
-H "Authorization: token $TOKEN" \
|
-H "Authorization: token $TOKEN" \
|
||||||
--upload-file "$src" \
|
--upload-file "$src" \
|
||||||
"$BASE/$VERSION/$dst_name")
|
"$BASE/$VERSION/$dst_name")
|
||||||
if [[ "$HTTP" != "20"* ]]; then
|
if [[ "$HTTP" != "20"* ]]; then
|
||||||
echo "✗ Upload failed — HTTP $HTTP"
|
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
|
exit 1
|
||||||
fi
|
fi
|
||||||
echo "✓ $dst_name → $BASE/$VERSION/$dst_name"
|
echo "✓ $dst_name → $BASE/$VERSION/$dst_name"
|
||||||
|
|||||||
Reference in New Issue
Block a user