Skip to content

Commit 272c8e6

Browse files
committed
update build.yml
1 parent b555400 commit 272c8e6

1 file changed

Lines changed: 21 additions & 11 deletions

File tree

.github/workflows/build.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,25 +67,35 @@ jobs:
6767
- name: Sign APK
6868
id: sign_apk
6969
run: |
70-
# Find the unsigned APK
71-
APK_PATH=$(find android/app/build/outputs/apk/release -name "*-release-unsigned.apk" -o -name
72-
"*-release.apk" | head -1)
73-
echo "Found APK: $APK_PATH"
74-
75-
# Align the APK (Optimization step required before signing)
76-
$ANDROID_HOME/build-tools/34.0.0/zipalign -v -p 4 "$APK_PATH" release-aligned.apk
77-
78-
# Sign the APK
79-
$ANDROID_HOME/build-tools/34.0.0/apksigner sign --ks release.keystore \
70+
cd android
71+
APK_PATH=$(find ./app/build/outputs/apk/release \
72+
\( -name "*-release-unsigned.apk" -o -name "*-release.apk" \) \
73+
-print -quit)
74+
75+
if [[ -z "$APK_PATH" ]]; then
76+
echo "❌ No APK found! Exiting."
77+
exit 1
78+
fi
79+
80+
echo "📦 Found APK: $APK_PATH"
81+
82+
BUILD_TOOLS_DIR=$(ls -1 "$ANDROID_HOME/build-tools" | sort -V | tail -n1)
83+
ZIPALIGN="$ANDROID_HOME/build-tools/$BUILD_TOOLS_DIR/zipalign"
84+
APKSIGNER="$ANDROID_HOME/build-tools/$BUILD_TOOLS_DIR/apksigner"
85+
86+
"$ZIPALIGN" -v -p 4 "$APK_PATH" release-aligned.apk
87+
"$APKSIGNER" sign \
88+
--ks release.keystore \
8089
--ks-key-alias "${{ secrets.KEY_ALIAS }}" \
8190
--ks-pass "pass:${{ secrets.KEYSTORE_PASSWORD }}" \
8291
--key-pass "pass:${{ secrets.KEY_PASSWORD }}" \
8392
--out release-signed.apk \
8493
release-aligned.apk
8594
86-
echo "✅ APK Signed successfully"
95+
echo "✅ APK signed"
8796
echo "signed_apk_path=release-signed.apk" >> $GITHUB_OUTPUT
8897
98+
8999
# Build the AAB (Android App Bundle)
90100
- name: Build Release AAB
91101
run: |

0 commit comments

Comments
 (0)