===============================================================
  OPCIÓN C — GITHUB ACTIONS
===============================================================

REQUISITO PREVIO
----------------
Mover el repo oasis_mobile a GitHub (público o privado).
Actualmente está en Gitea code.03c8.net:3000.

Razón: GitHub Actions solo corre en repos de GitHub.


ARCHIVO: .github/workflows/upstream-sync.yml
--------------------------------------------

  name: Upstream sync (weekly)

  on:
    schedule:
      - cron: '0 3 * * 1'    # Lunes 03:00 UTC
    workflow_dispatch: {}    # también manual

  jobs:
    sync-and-build:
      runs-on: ubuntu-latest
      timeout-minutes: 60

      steps:
        - uses: actions/checkout@v4
          with:
            fetch-depth: 0

        - name: Add upstream remote
          run: |
            git remote add upstream https://github.com/epsylon/oasis.git
            git fetch upstream

        - name: Check for upstream changes
          id: check
          run: |
            BEHIND=$(git rev-list HEAD..upstream/main --count)
            echo "behind=$BEHIND" >> $GITHUB_OUTPUT

        - name: Setup Claude Code
          if: steps.check.outputs.behind != '0'
          uses: anthropics/claude-code-action@v1
          with:
            anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
            prompt-file: .github/prompts/upstream-merge.md

        - name: Install Android SDK
          if: steps.check.outputs.behind != '0'
          uses: android-actions/setup-android@v3

        - name: Build APK
          if: steps.check.outputs.behind != '0'
          run: bash .github/scripts/build-apk.sh
          env:
            KEYSTORE_PASS: ${{ secrets.KEYSTORE_PASS }}

        - name: Upload APK artifact
          if: steps.check.outputs.behind != '0'
          uses: actions/upload-artifact@v4
          with:
            name: oasis-mobile-apk-${{ github.run_number }}
            path: /tmp/oasis-aligned.apk
            retention-days: 30

        - name: Create release
          if: steps.check.outputs.behind != '0'
          uses: softprops/action-gh-release@v1
          with:
            tag_name: auto-${{ github.run_number }}
            files: /tmp/oasis-aligned.apk
            prerelease: true


SECRETS A CONFIGURAR EN GITHUB
------------------------------
  ANTHROPIC_API_KEY   <- API key de Anthropic
  KEYSTORE_PASS       <- "oasis123"
  KEYSTORE_BASE64     <- base64 del oasis-release-key.jks
  TELEGRAM_BOT_TOKEN  <- opcional para notificar


PROS
----
  - Gratis (2000 minutos/mes en repo privado, ilimitado público)
  - Histórico completo y auditable
  - Artifacts descargables 30 días
  - Crea release de pre-release automáticamente
  - Sin VPS, sin mantenimiento de infra


CONTRAS
-------
  - Hay que mover el repo a GitHub
  - Build APK consume ~10-15 min, costo eficiencia OK
  - Si la API key se filtra, alguien podría gastar tu cuenta
  - Si Anthropic baja prices o cambia API, hay que actualizar


COSTE ESTIMADO
--------------
  GitHub Actions: 0 €/mes (dentro del free tier)
  Anthropic API: ~0.50€ por sync semanal x 4 = 2€/mes
  Total: 2€/mes vs VPS 5-10€/mes para opción A/B/D


CUÁNDO ES MEJOR ESTA OPCIÓN
---------------------------
  - Si no tienes/quieres mantener un VPS
  - Si te da igual mover el repo a GitHub
  - Si quieres logs públicos auditables
  - Si quieres distribución automática de pre-releases
