forked from maybe-finance/maybe
-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (141 loc) · 5.26 KB
/
flutter-build.yml
File metadata and controls
170 lines (141 loc) · 5.26 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
name: Flutter Mobile Build
on:
workflow_call:
workflow_dispatch:
permissions:
contents: read
jobs:
build-android:
name: Build Android APK
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.32.4'
channel: 'stable'
cache: true
- name: Get dependencies
working-directory: mobile
run: flutter pub get
- name: Copy Sure icons from public/
run: cp public/android-chrome-512x512.png mobile/assets/icon/app_icon.png
- name: Generate app icons
working-directory: mobile
run: flutter pub run flutter_launcher_icons
- name: Analyze code
working-directory: mobile
run: flutter analyze --no-fatal-infos
- name: Run tests
working-directory: mobile
run: flutter test
- name: Check if keystore secrets exist
id: check_secrets
run: |
if [ -n "${{ secrets.KEYSTORE_BASE64 }}" ]; then
echo "has_keystore=true" >> $GITHUB_OUTPUT
echo "✓ Keystore secrets found, will build signed APK"
else
echo "has_keystore=false" >> $GITHUB_OUTPUT
echo "⚠ No keystore secrets, will build unsigned debug APK"
fi
- name: Decode and setup keystore
if: steps.check_secrets.outputs.has_keystore == 'true'
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
run: |
echo "$KEYSTORE_BASE64" | base64 -d > mobile/android/app/upload-keystore.jks
echo "storePassword=$KEY_STORE_PASSWORD" > mobile/android/key.properties
echo "keyPassword=$KEY_PASSWORD" >> mobile/android/key.properties
echo "keyAlias=$KEY_ALIAS" >> mobile/android/key.properties
echo "storeFile=upload-keystore.jks" >> mobile/android/key.properties
echo "✓ Keystore configured successfully"
- name: Build APK (Release)
working-directory: mobile
run: |
if [ "${{ steps.check_secrets.outputs.has_keystore }}" == "true" ]; then
echo "Building signed release APK..."
flutter build apk --release
else
echo "Building debug-signed APK..."
flutter build apk --debug
fi
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: app-release-apk
path: |
mobile/build/app/outputs/flutter-apk/app-release.apk
mobile/build/app/outputs/flutter-apk/app-debug.apk
retention-days: 30
if-no-files-found: ignore
- name: Build App Bundle (Release)
if: steps.check_secrets.outputs.has_keystore == 'true'
working-directory: mobile
run: flutter build appbundle --release
- name: Upload AAB artifact
if: steps.check_secrets.outputs.has_keystore == 'true'
uses: actions/upload-artifact@v4
with:
name: app-release-aab
path: mobile/build/app/outputs/bundle/release/app-release.aab
retention-days: 30
build-ios:
name: Build iOS IPA
runs-on: macos-latest
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.32.4'
channel: 'stable'
cache: true
- name: Get dependencies
working-directory: mobile
run: flutter pub get
- name: Copy Sure icons from public/
run: cp public/android-chrome-512x512.png mobile/assets/icon/app_icon.png
- name: Generate app icons
working-directory: mobile
run: flutter pub run flutter_launcher_icons
- name: Install CocoaPods dependencies
working-directory: mobile/ios
run: pod install
- name: Analyze code
working-directory: mobile
run: flutter analyze --no-fatal-infos
- name: Run tests
working-directory: mobile
run: flutter test
- name: Build iOS (No Code Signing)
working-directory: mobile
run: flutter build ios --release --no-codesign
- name: Create IPA archive info
working-directory: mobile
run: |
echo "iOS build completed successfully" > build/ios-build-info.txt
echo "Build date: $(date)" >> build/ios-build-info.txt
echo "Note: This build is not code-signed and cannot be installed on physical devices" >> build/ios-build-info.txt
echo "For distribution, you need to configure code signing with Apple certificates" >> build/ios-build-info.txt
- name: Upload iOS build artifact
uses: actions/upload-artifact@v4
with:
name: ios-build-unsigned
path: |
mobile/build/ios/iphoneos/Runner.app
mobile/build/ios-build-info.txt
retention-days: 30