@@ -2,41 +2,48 @@ name: Dev Test Build
22
33on :
44 push :
5- branches : [ "dev" ] # Only runs when you push to the dev branch
5+ branches : [ "dev" ]
66
77jobs :
88 build :
99 runs-on : ubuntu-latest
10+
1011 steps :
11- - name : Checkout code
12- uses : actions/checkout@v4
13-
14- - name : Set up JDK 17
15- uses : actions/setup-java@v4
16- with :
17- java-version : ' 17'
18- distribution : ' temurin'
19-
20- - name : Make gradlew executable
21- run : chmod +x ./gradlew
22-
23- - name : Build Release APK
24- run : ./gradlew assembleRelease
25-
26- # Signs the app with your exact production keys so you don't have to uninstall the old one!
27- - name : Sign APK
28- uses : ilharp/sign-android-release@v1
29- id : sign_app
30- with :
31- releaseDir : app/build/outputs/apk/release
32- signingKeyBase64 : ${{ secrets.KEYSTORE }}
33- alias : ${{ secrets.KEY_ALIAS }}
34- keyStorePassword : ${{ secrets.KEYSTORE_PASSWORD }}
35- keyPassword : ${{ secrets.KEY_PASSWORD }}
36-
37- # Uploads the file privately to the GitHub run instead of making a public release
38- - name : Upload Test APK
39- uses : actions/upload-artifact@v4
40- with :
41- name : BatteryRemapper-Dev-Test
42- path : ${{steps.sign_app.outputs.signedFile}}
12+ - name : Checkout Code
13+ uses : actions/checkout@v4
14+
15+ - name : Set up Java Development Kit (JDK)
16+ uses : actions/setup-java@v4
17+ with :
18+ java-version : ' 17'
19+ distribution : ' temurin'
20+
21+ # Using global gradle exactly like your main branch
22+ - name : Compile Release APK using Gradle
23+ run : gradle assembleRelease
24+
25+ # Using your exact keystore decoding logic
26+ - name : Decode Permanent Keystore
27+ run : |
28+ cat << 'EOF' > encoded_key.txt
29+ ${{ secrets.KEYSTORE_BASE64 }}
30+ EOF
31+ sed -i '/---/d' encoded_key.txt
32+ tr -d '\r\n ' < encoded_key.txt | base64 --decode > release.keystore
33+
34+ # Using your exact signing logic so the dev APK matches production signatures perfectly
35+ - name : Zipalign and Sign Release APK (V2 Signature)
36+ run : |
37+ BUILD_TOOLS_DIR=$(ls -d $ANDROID_HOME/build-tools/* | tail -1)
38+
39+ $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
40+
41+ $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
42+
43+ # Uploads privately to the Actions tab instead of creating a public release
44+ - name : Upload Test APK
45+ uses : actions/upload-artifact@v4
46+ with :
47+ name : BatteryRemapper-Dev-Test
48+ path : app/build/outputs/apk/release/BatteryRemapper.apk
49+ compression-level : 0
0 commit comments