Files
web-imposter-game/.gitea/workflows/build-apk.yml
Dasemu 068c7282ea
All checks were successful
Build Android APK / build (push) Successful in 6m31s
feat: update APK build process to rename output and publish latest release
2026-01-22 09:53:17 +01:00

85 lines
2.2 KiB
YAML

name: Build Android APK
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install dependencies
run: npm ci
- name: Sync Capacitor
run: npx cap sync android
- name: Decode keystore
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/impostor.keystore
- name: Create keystore.properties
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
run: |
cat > android/keystore.properties << EOF
storeFile=../impostor.keystore
storePassword=${{ secrets.KEYSTORE_PASSWORD }}
keyAlias=${{ secrets.KEY_ALIAS }}
keyPassword=${{ secrets.KEY_PASSWORD }}
EOF
- name: Build Release APK
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
working-directory: android
run: ./gradlew assembleRelease --no-daemon
- name: Build Debug APK (fallback)
if: ${{ secrets.KEYSTORE_BASE64 == '' }}
working-directory: android
run: ./gradlew assembleDebug --no-daemon
- name: Rename APK
run: |
if [ -f android/app/build/outputs/apk/release/app-release.apk ]; then
cp android/app/build/outputs/apk/release/app-release.apk impostor-game.apk
else
cp android/app/build/outputs/apk/debug/app-debug.apk impostor-game.apk
fi
- name: Update latest release
uses: softprops/action-gh-release@v2
with:
tag_name: latest
name: Latest Build
body: |
Última versión del APK generada automáticamente.
Commit: ${{ github.sha }}
files: impostor-game.apk
prerelease: false
make_latest: true