From 3c5002cdacb0cf63a9f33cb3d29c10b454788b2f Mon Sep 17 00:00:00 2001
From: Tim Perry <pimterry@gmail.com>
Date: Tue, 19 Nov 2024 17:37:29 +0100
Subject: [PATCH] Test publishing AAB

---
 .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++----------
 app/build.gradle         |  4 ++--
 2 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c6a5d8b..027faee 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,15 +16,24 @@ jobs:
       - name: Setup Android SDK
         uses: android-actions/setup-android@v2
 
-      - name: Build release
+      - name: Build release APK
         run: ./gradlew assembleRelease
 
+      - name: Build release AAB
+        run: ./gradlew bundleRelease
+
       - uses: actions/upload-artifact@v4
         with:
           name: unsigned-app.apk
           path: app/build/outputs/apk/release/app-release-unsigned.apk
           if-no-files-found: error
 
+      - uses: actions/upload-artifact@v4
+        with:
+          name: unsigned-app.aab
+          path: app/build/outputs/bundle/release/app-release.aab
+          if-no-files-found: error
+
   deploy:
     name: Deploy to GitHub Releases
     needs: build
@@ -37,6 +46,13 @@ jobs:
           name: unsigned-app.apk
           path: .
 
+
+      - name: Get the AAB
+        uses: actions/download-artifact@v4
+        with:
+          name: unsigned-app.aab
+          path: .
+
       - name: Detect latest build tool version
         shell: bash
         run: |
@@ -44,7 +60,7 @@ jobs:
           echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
           echo Latest build tool version is: $BUILD_TOOL_VERSION
 
-      - name: Sign the APK
+      - name: Sign the APK & AAB
         uses: r0adkll/sign-android-release@v1
         id: sign_app
         with:
@@ -56,19 +72,27 @@ jobs:
         env:
           BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
 
-      - name: Publish the APK to GitHub Releases
+      - name: List release files
+        run: ls -l
+
+      - name: Rename release files
+        run: |
+          mv ./app-release-unsigned-signed.apk ./httptoolkit.apk
+          mv ./app-release.aab ./httptoolkit.aab
+
+      - name: Publish the APK & AAB to GitHub Releases
         uses: svenstaro/upload-release-action@v2
         with:
           prerelease: true
-          asset_name: httptoolkit.apk
-          file: ${{ steps.sign_app.outputs.signedReleaseFile }}
+          file: ./httptoolkit{.apk,.aab}
+          file_glob: true
           tag: ${{ github.ref }}
           repo_token: ${{ secrets.GITHUB_TOKEN }}
 
-      - name: Publish the APK to Google Play
-        uses: r0adkll/upload-google-play@v1.0.15
-        with:
-          serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
-          packageName: tech.httptoolkit.android.v1
-          releaseFiles: ${{ steps.sign_app.outputs.signedReleaseFile }}
-          track: production
\ No newline at end of file
+      # - name: Publish the AAB to Google Play
+      #   uses: r0adkll/upload-google-play@v1.0.15
+      #   with:
+      #     serviceAccountJsonPlainText: ${{ secrets.PLAY_SERVICE_ACCOUNT_JSON }}
+      #     packageName: tech.httptoolkit.android.v1
+      #     releaseFiles: ${{ steps.sign_app.outputs.signedReleaseFile1 }}
+      #     track: production
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index a9e11e8..ac6e7ac 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -9,8 +9,8 @@ android {
         applicationId "tech.httptoolkit.android.v1"
         minSdkVersion 21
         targetSdkVersion 33
-        versionCode 33
-        versionName "1.4.0"
+        versionCode 34
+        versionName "1.5.0"
 
         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"