feat: enhance APK build process with keystore handling and fallback options
Some checks failed
Build Android APK / build (push) Has been cancelled
Some checks failed
Build Android APK / build (push) Has been cancelled
This commit is contained in:
47
.github/workflows/build-apk.yml
vendored
47
.github/workflows/build-apk.yml
vendored
@@ -25,11 +25,6 @@ jobs:
|
||||
distribution: 'temurin'
|
||||
java-version: '21'
|
||||
|
||||
- name: Verify Java Version
|
||||
run: |
|
||||
java -version
|
||||
echo "JAVA_HOME=$JAVA_HOME"
|
||||
|
||||
- name: Setup Android SDK
|
||||
uses: android-actions/setup-android@v3
|
||||
|
||||
@@ -39,17 +34,41 @@ jobs:
|
||||
- name: Sync Capacitor
|
||||
run: npx cap sync android
|
||||
|
||||
- name: Build APK
|
||||
working-directory: android
|
||||
- name: Decode keystore
|
||||
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
|
||||
run: |
|
||||
export JAVA_HOME="${JAVA_HOME}"
|
||||
echo "Using Java from: $JAVA_HOME"
|
||||
java -version
|
||||
javac -version
|
||||
./gradlew --version
|
||||
./gradlew assembleDebug --no-daemon --stacktrace
|
||||
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/impostor.keystore
|
||||
|
||||
- name: Upload APK
|
||||
- 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
|
||||
|
||||
Reference in New Issue
Block a user