From 0722902ae454a1f5752b6dc89c9e163a1067b7fe Mon Sep 17 00:00:00 2001 From: donald-okara Date: Sun, 17 Nov 2024 21:45:16 +0300 Subject: [PATCH] Workflow: Added signing to workflow --- .../generate-apk-aab-debug-release.yml | 36 ++++++++++++------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/.github/workflows/generate-apk-aab-debug-release.yml b/.github/workflows/generate-apk-aab-debug-release.yml index 344960c..d5ad6ee 100644 --- a/.github/workflows/generate-apk-aab-debug-release.yml +++ b/.github/workflows/generate-apk-aab-debug-release.yml @@ -1,10 +1,10 @@ -name: Generated APK AAB (Upload - Create Artifact To Github Action) +name: Generate APK AAB and Upload as Artifact env: # The name of the main module repository main_project_module: app - # The name of the app (now changed to Preface) + # The name of the app app_name: Preface on: @@ -37,34 +37,43 @@ jobs: java-version: '17' cache: 'gradle' - - name: Load Google Service file + # Install Android SDK Build Tools + - name: Install Android Build Tools + run: yes | sdkmanager "build-tools;33.0.0" # Adjust version if needed + + # Ensure zipalign is in PATH + - name: Add build-tools to PATH + run: echo "::add-path::/usr/local/lib/android/sdk/build-tools/33.0.0" # Adjust version if needed + + - name: Load Google Service File env: DATA: ${{ secrets.GOOGLE_SERVICES_JSON }} run: echo $DATA | base64 -di > app/google-services.json - - name: Load secrets xml file + - name: Load Secrets XML File env: - DATA: ${{ secrets.SECRETS_XML}} + DATA: ${{ secrets.SECRETS_XML }} run: echo $DATA | base64 -di > app/src/main/res/values/secrets.xml - - name: Change wrapper permissions + - name: Change Wrapper Permissions run: chmod +x ./gradlew # Run Tests Build - - name: Run gradle tests + - name: Run Gradle Tests run: ./gradlew test # Run Build Project - - name: Build gradle project + - name: Build Gradle Project run: ./gradlew build + # Decode KeyStore - name: Decode KeyStore run: echo "${{ secrets.SIGNINGKEYBASE64 }}" | base64 -d > preface-keystore.jks - name: Build App - run: | - ./gradlew assembleRelease + run: ./gradlew assembleRelease + # Sign APK - name: Sign APK run: | jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 \ @@ -73,12 +82,13 @@ jobs: app/build/outputs/apk/release/app-release-unsigned.apk \ "${{ secrets.KEY_ALIAS }}" + # Align APK - name: Align APK - run: | - zipalign -v 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release.apk + run: zipalign -v 4 app/build/outputs/apk/release/app-release-unsigned.apk app/build/outputs/apk/release/app-release.apk + # Upload Release APK as Artifact - name: Upload Release APK uses: actions/upload-artifact@v3 with: name: Preface-App - path: app/build/outputs/apk/release/app-release.apk \ No newline at end of file + path: app/build/outputs/apk/release/app-release.apk