ci: save APKs as workflow artifacts; best-effort package registry upload
Some checks failed
Android Build & Publish / android (push) Failing after 1m58s

This commit is contained in:
Giancarmine Salucci
2026-05-24 16:48:12 +02:00
parent 052728c168
commit bfb0cc87ca

View File

@@ -93,10 +93,21 @@ jobs:
working-directory: android
run: ./gradlew assembleRelease --no-daemon
# ── 9. Publish to Gitea generic package registry ─────────────────────────
# ── 9. Upload APKs as workflow artifacts ─────────────────────────────────
- name: Upload APKs as artifacts
uses: actions/upload-artifact@v4
with:
name: scopone-android-${{ github.run_number }}
path: |
android/app/build/outputs/apk/debug/app-debug.apk
android/app/build/outputs/apk/release/app-release-unsigned.apk
retention-days: 30
# ── 10. Publish to Gitea generic package registry (best-effort) ──────────
- name: Publish APKs to Gitea package registry
continue-on-error: true
env:
TOKEN: ${{ github.token }}
GITEA_ACTOR: ${{ gitea.actor }}
run: |
set -euo pipefail
VERSION="${{ github.run_number }}"
@@ -105,23 +116,18 @@ jobs:
upload() {
local src="$1" dst_name="$2"
echo "→ Uploading $dst_name (version $VERSION)…"
# --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" \
-u "gitea-actions:${{ secrets.GITEA_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
echo " HTTP $HTTP"
if [[ "$HTTP" == "20"* ]]; then
echo "✓ $dst_name → $BASE/$VERSION/$dst_name"
else
echo "⚠ Package registry upload skipped (HTTP $HTTP) — download APKs from the workflow artifacts above"
fi
echo "✓ $dst_name → $BASE/$VERSION/$dst_name"
}
upload android/app/build/outputs/apk/debug/app-debug.apk \
@@ -129,6 +135,3 @@ jobs:
upload android/app/build/outputs/apk/release/app-release-unsigned.apk \
app-release-unsigned.apk
echo ""
echo "📦 Package index: $BASE/$VERSION/"