diff --git a/.github/workflows/build-apk.yml b/.github/workflows/build-apk.yml index 7bc7914..64316bf 100644 --- a/.github/workflows/build-apk.yml +++ b/.github/workflows/build-apk.yml @@ -34,13 +34,24 @@ jobs: - name: Sync Capacitor run: npx cap sync android + - name: Check if keystore exists + id: keystore-check + run: | + if [ -n "$KEYSTORE_BASE64" ]; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + env: + KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }} + - name: Decode keystore - if: ${{ secrets.KEYSTORE_BASE64 != '' }} + if: steps.keystore-check.outputs.exists == 'true' run: | echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 -d > android/impostor.keystore - name: Create keystore.properties - if: ${{ secrets.KEYSTORE_BASE64 != '' }} + if: steps.keystore-check.outputs.exists == 'true' run: | cat > android/keystore.properties << EOF storeFile=../impostor.keystore @@ -50,17 +61,17 @@ jobs: EOF - name: Build Release APK - if: ${{ secrets.KEYSTORE_BASE64 != '' }} + if: steps.keystore-check.outputs.exists == 'true' working-directory: android run: ./gradlew assembleRelease --no-daemon - name: Build Debug APK (fallback) - if: ${{ secrets.KEYSTORE_BASE64 == '' }} + if: steps.keystore-check.outputs.exists == 'false' working-directory: android run: ./gradlew assembleDebug --no-daemon - name: Upload Release APK - if: ${{ secrets.KEYSTORE_BASE64 != '' }} + if: steps.keystore-check.outputs.exists == 'true' uses: actions/upload-artifact@v4 with: name: impostor-game-release @@ -68,9 +79,9 @@ jobs: retention-days: 30 - name: Upload Debug APK (fallback) - if: ${{ secrets.KEYSTORE_BASE64 == '' }} + if: steps.keystore-check.outputs.exists == 'false' uses: actions/upload-artifact@v4 with: name: impostor-game-debug path: android/app/build/outputs/apk/debug/app-debug.apk - retention-days: 30 + retention-days: 30 \ No newline at end of file