1- name : Flutter Android CI
1+ name : Android CI / Build & Release APK
22
33on :
44 push :
55 tags :
6- - ' *'
6+ - ' v *'
77 workflow_dispatch :
88
9+ permissions :
10+ contents : write
11+ actions : read
12+
13+ concurrency :
14+ group : ${{ github.workflow }}-${{ github.ref }}
15+ cancel-in-progress : true
16+
917jobs :
1018 build-apk :
1119 runs-on : ubuntu-latest
1422 - name : Checkout repository
1523 uses : actions/checkout@v4
1624
25+ - name : Cache pub deps
26+ uses : actions/cache@v3
27+ with :
28+ path : ~/.pub-cache
29+ key : ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
30+ restore-keys : ${{ runner.os }}-pub-
31+
1732 - name : Set up Java
1833 uses : actions/setup-java@v4
1934 with :
@@ -33,11 +48,18 @@ jobs:
3348 run : flutter pub run flutter_launcher_icons
3449
3550 - name : Build release APK
36- run : flutter build apk --release
51+ run : flutter build apk --release --split-per-abi
52+
53+ - name : Prepare artifacts
54+ run : |
55+ mkdir -p artifacts
56+ cp build/app/outputs/flutter-apk/*.apk artifacts/
3757
38- - name : Upload APK artifact
39- uses : actions/upload-artifact@v4
58+ - name : Create or update Release
59+ if : startsWith(github.ref, 'refs/tags/v')
60+ uses : ncipollo/release-action@v1.16.0
4061 with :
41- name : app-release-apk
42- path : build/app/outputs/flutter-apk/app-release.apk
43- retention-days : 30
62+ tag : ${{ github.ref_name }}
63+ name : Release ${{ github.ref_name }}
64+ artifacts : artifacts/*.apk
65+ token : ${{ secrets.GITHUB_TOKEN }}
0 commit comments