Files
web-imposter-game/.github/workflows/build-apk.yml
Dasemu ae3ce89516
Some checks failed
Build Android APK / build (push) Has been cancelled
feat: enhance APK build process with keystore handling and fallback options
2026-01-22 09:30:27 +01:00

77 lines
2.1 KiB
YAML

name: Build Android APK
on:
push:
branches: [main]
workflow_dispatch:
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: Upload Release APK
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
uses: actions/upload-artifact@v4
with:
name: impostor-game-release
path: android/app/build/outputs/apk/release/app-release.apk
retention-days: 30
- name: Upload Debug APK (fallback)
if: ${{ secrets.KEYSTORE_BASE64 == '' }}
uses: actions/upload-artifact@v4
with:
name: impostor-game-debug
path: android/app/build/outputs/apk/debug/app-debug.apk
retention-days: 30