Skip to content

Merge pull request #491 from Guillergood/master #13

Merge pull request #491 from Guillergood/master

Merge pull request #491 from Guillergood/master #13

Workflow file for this run

name: Debug Build
concurrency:
group: "build"
cancel-in-progress: true
on:
push:
paths-ignore:
- '*.md'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
# ── 1. CHECKOUT ────────────────────────────────────────────────────────────
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 1
# ── 2. PERMISOS ────────────────────────────────────────────────────────────
- name: Grant execute permission for gradlew
run: chmod +x gradlew
# ── 3. JDK ─────────────────────────────────────────────────────────────────
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
# ── 4. GRADLE CACHE ────────────────────────────────────────────────────────
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache-read-only: false
# ── 5. SIGNING ─────────────────────────────────────────────────────────────
# - Si DEBUG_KEYSTORE_BASE64 existe → lo decodifica y lo usa (firma consistente)
# - Si no existe → genera uno aleatorio con aviso (firma efímera)
# En ambos casos termina con los env vars de firma configurados.
- name: Setup debug keystore & signing env vars
env:
KEYSTORE_SECRET: ${{ secrets.DEBUG_KEYSTORE_BASE64 }}
run: |
mkdir -p "$RUNNER_TEMP/keystore/"
if [ -n "$KEYSTORE_SECRET" ]; then
printf '%s' "$KEYSTORE_SECRET" | base64 -d > "$RUNNER_TEMP/keystore/prerelease.keystore"
echo "✅ Keystore cargado desde DEBUG_KEYSTORE_BASE64"
else
keytool -genkey -v \
-keystore "$RUNNER_TEMP/keystore/prerelease.keystore" \
-storepass android \
-keypass android \
-alias androiddebugkey \
-keyalg RSA -keysize 2048 -validity 10000 \
-dname "C=US, O=Android, CN=Android Debug"
echo ""
echo "════════════════════════════════════════════════════════"
echo "⚠️ DEBUG_KEYSTORE_BASE64 no está configurado."
echo " Este APK usa una firma aleatoria — no podrás instalar"
echo " esta build sobre una anterior sin desinstalarla antes."
echo ""
echo " Para fijar esta firma de forma permanente, copia el"
echo " bloque de abajo y añádelo en:"
echo " Settings → Secrets and variables → Actions → [New Repository Secret]"
echo " Nombre del secret: DEBUG_KEYSTORE_BASE64"
echo "════════════════════════════════════════════════════════"
base64 "$RUNNER_TEMP/keystore/prerelease.keystore"
echo "════════════════════════════════════════════════════════"
fi
echo "MUSIC_DEBUG_KEYSTORE_FILE=$RUNNER_TEMP/keystore/prerelease.keystore" >> $GITHUB_ENV
echo "MUSIC_DEBUG_SIGNING_STORE_PASSWORD=android" >> $GITHUB_ENV
echo "MUSIC_DEBUG_SIGNING_KEY_PASSWORD=android" >> $GITHUB_ENV
echo "MUSIC_DEBUG_SIGNING_KEY_ALIAS=androiddebugkey" >> $GITHUB_ENV
# ── 6. BUILD ───────────────────────────────────────────────────────────────
# --build-cache → reutiliza outputs de tareas cacheadas
# --configuration-cache → cachea la fase de configuración de Gradle
# --parallel → ejecuta tareas independientes en paralelo
- name: Build Debug APK
run: ./gradlew assembleDebug --build-cache --configuration-cache --parallel
# ── 7. ARTIFACT ────────────────────────────────────────────────────────────
- name: Upload Debug APK
uses: actions/upload-artifact@v4
with:
name: debug-apk-${{ github.ref_name }}-run${{ github.run_number }}
path: "app/build/outputs/apk/debug/*.apk"
retention-days: 7