diff --git a/.gitea/workflows/build-apk.yml b/.gitea/workflows/build-apk.yml index 5e47225..7bc7914 100644 --- a/.gitea/workflows/build-apk.yml +++ b/.gitea/workflows/build-apk.yml @@ -34,12 +34,42 @@ jobs: - name: Sync Capacitor run: npx cap sync android - - name: Build APK - working-directory: android - run: ./gradlew assembleDebug + - name: Decode keystore + if: ${{ secrets.KEYSTORE_BASE64 != '' }} + run: | + echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/impostor.keystore - - name: Upload APK - uses: actions/upload-artifact@v3 + - 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 diff --git a/.github/workflows/build-apk.yml b/.github/workflows/build-apk.yml index 19a7567..7bc7914 100644 --- a/.github/workflows/build-apk.yml +++ b/.github/workflows/build-apk.yml @@ -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