-
Notifications
You must be signed in to change notification settings - Fork 110
95 lines (85 loc) · 5.18 KB
/
debugBuild.yml
File metadata and controls
95 lines (85 loc) · 5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
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