From 7b742f856134713d74d90d247df370ab6917f21b Mon Sep 17 00:00:00 2001
From: kooritea <github@kooritea.moe>
Date: Fri, 12 Apr 2024 22:52:20 +0800
Subject: [PATCH] Update android.yml

---
 .github/workflows/android.yml | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 8157d86..b162a19 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -28,7 +28,14 @@ jobs:
       
     - name: Build with Gradle
       run: ./gradlew assembleRelease
-      
+
+    - name: Setup build tool version variable
+      shell: bash
+      run: |
+        BUILD_TOOL_VERSION=$(ls /usr/local/lib/android/sdk/build-tools/ | tail -n 1)
+        echo "BUILD_TOOL_VERSION=$BUILD_TOOL_VERSION" >> $GITHUB_ENV
+        echo Last build tool version is: $BUILD_TOOL_VERSION
+
     - name: Sign APK
       uses: r0adkll/sign-android-release@v1
       with:
@@ -38,7 +45,7 @@ jobs:
         keyStorePassword: ${{ secrets.KEYSTOREPASSWORD }}
         keyPassword: ${{ secrets.KEYPASSWORD }}
       env:
-        BUILD_TOOLS_VERSION: "30.0.2"
+        BUILD_TOOLS_VERSION: ${{ env.BUILD_TOOL_VERSION }}
 
     - name: Renamae
       run: mv ${{ github.workspace }}/app/build/outputs/apk/release/app-release-unsigned-signed.apk ${{ github.workspace }}/app/build/outputs/apk/release/fcmfix-ci-${{ env.VERSION }}.apk