-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (69 loc) · 2.17 KB
/
Copy pathflutter_ci_cd.yml
File metadata and controls
83 lines (69 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Flutter Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
pages: write
id-token: write
env:
FLUTTER_VERSION: '3.41.8'
JAVA_VERSION: '17'
jobs:
build-android:
name: Build & Release Android APK
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JAVA_VERSION }}
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: master
cache: true
- name: Install dependencies
run: flutter pub get
# ── Build split APKs (one per ABI) ──
- name: Build APKs (split per ABI)
run: |
flutter build apk \
--release \
--split-per-abi
# Output files:
# build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
# build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
# build/app/outputs/flutter-apk/app-x86_64-release.apk
- name: Rename APKs with version tag
run: |
TAG="${{ github.ref_name }}"
cd build/app/outputs/flutter-apk
for apk in app-*-release.apk; do
abi="${apk#app-}"
abi="${abi%-release.apk}"
mv "$apk" "app-${abi}-${TAG}.apk"
done
- name: Upload APKs as artifacts
uses: actions/upload-artifact@v4
with:
name: apks-${{ github.ref_name }}
path: build/app/outputs/flutter-apk/*.apk
retention-days: 7
# ── Create GitHub Release & attach APKs ──
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name }}
name: Release ${{ github.ref_name }}
draft: false
prerelease: ${{ contains(github.ref_name, '-') }} # e.g. v1.0.0-beta → pre-release
generate_release_notes: true
files: build/app/outputs/flutter-apk/*.apk
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}