Skip to content

Commit 4caa69d

Browse files
committed
chore:split apks to reduce size [build.apk]
1 parent 77f828a commit 4caa69d

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

.github/workflows/dart.yml

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,44 @@ jobs:
8383
8484
# Optimize Flutter build
8585
- run: flutter pub get
86-
- run: flutter build apk --release
86+
- run: flutter build apk --release --split-per-abi
8787

88-
- name: Rename APK
89-
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/Dantotsu_Android_${{github.ref_name}}.apk
88+
- name: Rename APKs
89+
run: |
90+
for file in build/app/outputs/flutter-apk/app-*-release.apk; do
91+
abi=$(basename $file | sed 's/app-\(.*\)-release.apk/\1/')
92+
mv $file build/app/outputs/flutter-apk/Dartotsu_Android_${abi}_${{github.ref_name}}.apk
93+
done
94+
ls build/app/outputs/flutter-apk
9095
91-
- name: Upload File To Google Drive
92-
id: gdriveUpload
96+
97+
- name: Upload arm64 File To Google Drive
98+
id: gdriveUpload_arm64
9399
uses: hoatruongdev09/google-drive-file-upload-github-action@v1.1
94100
with:
95-
file-path: build/app/outputs/flutter-apk/Dantotsu_Android_${{github.ref_name}}.apk
96-
upload-name: Dartotsu.apk
97-
upload-to-folder-id: 1nWYex54zd58SVitJUCva91_4k1PPTdP3
101+
file-path: build/app/outputs/flutter-apk/Dartotsu_Android_arm64-v8a_main.apk
102+
upload-name: Dartotsu_Android_arm64-v8a_${{github.ref_name}}.apk
103+
upload-to-folder-id: 1S4QzdKz7ZofhiF5GAvjMdBvYK7YhndKM
104+
service-account-json: "${{secrets.GOOGLE_KEY}}"
105+
overrwrite: true
106+
- name: Upload armeabi File To Google Drive
107+
id: gdriveUpload_armeabi
108+
uses: hoatruongdev09/google-drive-file-upload-github-action@v1.1
109+
with:
110+
file-path: build/app/outputs/flutter-apk/Dartotsu_Android_armeabi-v7a_main.apk
111+
upload-name: Dartotsu_Android_armeabi-v7a_${{github.ref_name}}.apk
112+
upload-to-folder-id: 1S4QzdKz7ZofhiF5GAvjMdBvYK7YhndKM
113+
service-account-json: "${{secrets.GOOGLE_KEY}}"
114+
overrwrite: true
115+
- name: Upload x86 File To Google Drive
116+
id: gdriveUpload_x86
117+
uses: hoatruongdev09/google-drive-file-upload-github-action@v1.1
118+
with:
119+
file-path: build/app/outputs/flutter-apk/Dartotsu_Android_x86_64_main.apk
120+
upload-name: Dartotsu_Android_x86_64_${{github.ref_name}}.apk
121+
upload-to-folder-id: 1S4QzdKz7ZofhiF5GAvjMdBvYK7YhndKM
98122
service-account-json: "${{secrets.GOOGLE_KEY}}"
99123
overrwrite: true
100-
101124
build_windows:
102125
runs-on: windows-latest
103126
if: contains(github.event.head_commit.message, '[build.windows]') || contains(github.event.head_commit.message, '[build]')

0 commit comments

Comments
 (0)