Update build.gradle.kts #17
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Dev Test Build | |
| on: | |
| push: | |
| branches: [ "dev" ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Set up Java Development Kit (JDK) | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| # Using global gradle exactly like your main branch | |
| - name: Compile Release APK using Gradle | |
| run: gradle assembleRelease -PversionCode=${{ github.run_number }} | |
| # Using your exact keystore decoding logic | |
| - name: Decode Permanent Keystore | |
| run: | | |
| cat << 'EOF' > encoded_key.txt | |
| ${{ secrets.KEYSTORE_BASE64 }} | |
| EOF | |
| sed -i '/---/d' encoded_key.txt | |
| tr -d '\r\n ' < encoded_key.txt | base64 --decode > release.keystore | |
| # Using your exact signing logic so the dev APK matches production signatures perfectly | |
| - name: Zipalign and Sign Release APK (V2 Signature) | |
| run: | | |
| BUILD_TOOLS_DIR=$(ls -d $ANDROID_HOME/build-tools/* | tail -1) | |
| $BUILD_TOOLS_DIR/zipalign -v -p 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release-aligned.apk | |
| $BUILD_TOOLS_DIR/apksigner sign --ks release.keystore --ks-pass pass:${{ secrets.KEYSTORE_PASSWORD }} --out app/build/outputs/apk/release/BatteryRemapper.apk app/build/outputs/apk/release/app-release-aligned.apk | |
| # Uploads privately to the Actions tab instead of creating a public release | |
| - name: Upload Test APK | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: BatteryRemapper-Dev-Test | |
| path: app/build/outputs/apk/release/BatteryRemapper.apk | |
| compression-level: 0 |