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:
@@ -34,12 +34,42 @@ jobs:
|
|||||||
- name: Sync Capacitor
|
- name: Sync Capacitor
|
||||||
run: npx cap sync android
|
run: npx cap sync android
|
||||||
|
|
||||||
- name: Build APK
|
- name: Decode keystore
|
||||||
working-directory: android
|
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
|
||||||
run: ./gradlew assembleDebug
|
run: |
|
||||||
|
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/impostor.keystore
|
||||||
|
|
||||||
- name: Upload APK
|
- name: Create keystore.properties
|
||||||
uses: actions/upload-artifact@v3
|
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:
|
with:
|
||||||
name: impostor-game-debug
|
name: impostor-game-debug
|
||||||
path: android/app/build/outputs/apk/debug/app-debug.apk
|
path: android/app/build/outputs/apk/debug/app-debug.apk
|
||||||
|
|||||||
47
.github/workflows/build-apk.yml
vendored
47
.github/workflows/build-apk.yml
vendored
@@ -25,11 +25,6 @@ jobs:
|
|||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
java-version: '21'
|
java-version: '21'
|
||||||
|
|
||||||
- name: Verify Java Version
|
|
||||||
run: |
|
|
||||||
java -version
|
|
||||||
echo "JAVA_HOME=$JAVA_HOME"
|
|
||||||
|
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
|
|
||||||
@@ -39,17 +34,41 @@ jobs:
|
|||||||
- name: Sync Capacitor
|
- name: Sync Capacitor
|
||||||
run: npx cap sync android
|
run: npx cap sync android
|
||||||
|
|
||||||
- name: Build APK
|
- name: Decode keystore
|
||||||
working-directory: android
|
if: ${{ secrets.KEYSTORE_BASE64 != '' }}
|
||||||
run: |
|
run: |
|
||||||
export JAVA_HOME="${JAVA_HOME}"
|
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/impostor.keystore
|
||||||
echo "Using Java from: $JAVA_HOME"
|
|
||||||
java -version
|
|
||||||
javac -version
|
|
||||||
./gradlew --version
|
|
||||||
./gradlew assembleDebug --no-daemon --stacktrace
|
|
||||||
|
|
||||||
- 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
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: impostor-game-debug
|
name: impostor-game-debug
|
||||||
|
|||||||
Reference in New Issue
Block a user