diff --git a/.gitea/workflows/android-build.yml b/.gitea/workflows/android-build.yml index d302609..8453a01 100644 --- a/.gitea/workflows/android-build.yml +++ b/.gitea/workflows/android-build.yml @@ -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/"