-
Notifications
You must be signed in to change notification settings - Fork 0
209 lines (196 loc) · 8.95 KB
/
flutter.yml
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
on:
push:
branches:
- main
name: Flutter
jobs:
android:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable" # or: 'beta', 'dev' or 'master'
architecture: x64 # optional, x64 or arm64
cache: true
cache-key: 'flutter-${{ github.job }}-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
- uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "11"
- name: Cache
uses: actions/cache@v4
with:
path: |
build/
android/.gradle/
key: ${{ runner.os }}-flutter-${{ github.job }}-${{ hashFiles('**/*.gradle*', 'pubspec.lock') }}
- run: flutter --version
- run: flutter pub global activate flutterfire_cli
- run: flutter pub get
- run: flutter analyze
- run: flutter test
- name: save release key
env:
KEY_FILE_BASE64: ${{ secrets.KEY_FILE_BASE64 }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
run: |
echo "$KEY_FILE_BASE64" | base64 -d > "$(pwd)/release.keystore"
echo "storeFile=$(pwd)/release.keystore" >> android/key.properties
echo "keyAlias=$KEY_ALIAS" >> android/key.properties
echo "keyPassword=$KEY_PASSWORD" >> android/key.properties
echo "storePassword=$KEY_PASSWORD" >> android/key.properties
echo "VERSION_CODE=$GITHUB_RUN_NUMBER" > android/version.properties
# - run: flutter build apk --release
- run: curl -sL https://firebase.tools | bash
- run: echo "$FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL" > google-application-credentials.json
env:
FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL: ${{secrets.FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL}}
- run: rm lib/firebase_options.dart
- run: flutterfire configure -y --platforms=android --ios-bundle-id=com.prijindal.habbit-tracker --macos-bundle-id=com.prijindal.habbit-tracker --web-app-id=1:739292996360:web:5c24f4c3b47c73559e82bd --android-package-name=com.prijindal.habbit_tracker --windows-app-id=1:739292996360:web:5c24f4c3b47c73559e82bd
env:
GOOGLE_APPLICATION_CREDENTIALS: google-application-credentials.json
- run: flutter build appbundle --release
- uses: actions/upload-artifact@v4
with:
name: android
path: build/app/outputs
retention-days: 1
- uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.prijindal.habbit_tracker
track: internal
status: completed
releaseFiles: build/app/outputs/bundle/release/app-release.aab
mappingFile: build/app/outputs/mapping/release/mapping.txt
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable" # or: 'beta', 'dev' or 'master'
architecture: x64 # optional, x64 or arm64
cache: true
cache-key: 'flutter-${{ github.job }}-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
- run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev libwebkit2gtk-4.0-dev
- name: Cache
uses: actions/cache@v4
with:
path: build/
key: ${{ runner.os }}-flutter-${{ github.job }}-${{ hashFiles('pubspec.lock') }}
- run: flutter --version
- run: flutter pub global activate flutterfire_cli
- run: flutter pub get
- run: flutter analyze
- run: flutter test --coverage
- uses: codecov/codecov-action@v4
with:
flags: app-flutter
token: ${{ secrets.CODECOV_TOKEN }}
- run: curl -sL https://firebase.tools | bash
- run: echo "$FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL" > google-application-credentials.json
env:
FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL: ${{secrets.FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL}}
- run: rm lib/firebase_options.dart
- run: flutterfire configure -y --platforms=web --ios-bundle-id=com.prijindal.habbit-tracker --macos-bundle-id=com.prijindal.habbit-tracker --web-app-id=1:739292996360:web:5c24f4c3b47c73559e82bd --android-package-name=com.prijindal.habbit_tracker --windows-app-id=1:739292996360:web:5c24f4c3b47c73559e82bd
env:
GOOGLE_APPLICATION_CREDENTIALS: google-application-credentials.json
- run: flutter build web --release
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL }}'
channelId: live
projectId: habbit-tracker-prijindal
- uses: actions/upload-artifact@v4
with:
name: web
path: build/web
retention-days: 1
- run: flutter build linux --release
- uses: actions/upload-artifact@v4
with:
name: linux
path: build/linux
retention-days: 1
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable" # or: 'beta', 'dev' or 'master'
architecture: x64 # optional, x64 or arm64
cache: true
cache-key: 'flutter-${{ github.job }}-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
- name: Cache
uses: actions/cache@v4
with:
path: build/
key: ${{ runner.os }}-flutter-${{ github.job }}-${{ hashFiles('pubspec.lock') }}
- run: flutter --version
- run: flutter pub global activate flutterfire_cli
- run: flutter pub get
- run: flutter analyze
- run: flutter test
# - run: curl -sL https://firebase.tools | bash
# - run: echo "$FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL" > google-application-credentials.json
# env:
# FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL: ${{secrets.FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL}}
# - run: rm lib/firebase_options.dart
# - run: flutterfire configure -y --platforms=macos,ios --ios-bundle-id=com.prijindal.habbit-tracker --macos-bundle-id=com.prijindal.habbit-tracker --web-app-id=1:739292996360:web:5c24f4c3b47c73559e82bd --android-package-name=com.prijindal.habbit_tracker --windows-app-id=1:739292996360:web:5c24f4c3b47c73559e82bd
# env:
# GOOGLE_APPLICATION_CREDENTIALS: google-application-credentials.json
# - run: flutter build macos --release
# - uses: actions/upload-artifact@v4
# with:
# name: macos
# path: build/macos
# - run: flutter build ios --release --no-codesign
# - uses: actions/upload-artifact@v4
# with:
# name: ios
# path: build/ios
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: "stable" # or: 'beta', 'dev' or 'master'
architecture: x64 # optional, x64 or arm64
cache: true
cache-key: 'flutter-${{ github.job }}-:os:-:channel:-:version:-:arch:-:hash:'
cache-path: '${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:'
- name: Cache
uses: actions/cache@v4
with:
path: build/
key: ${{ runner.os }}-flutter-${{ github.job }}-${{ hashFiles('pubspec.lock') }}
- run: flutter --version
- run: flutter pub global activate flutterfire_cli
- run: flutter pub get
- run: flutter analyze
- run: flutter test
# - run: npm install -g firebase-tools
# - run: echo "$FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL" > google-application-credentials.json
# env:
# FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL: ${{secrets.FIREBASE_SERVICE_ACCOUNT_HABBIT_TRACKER_PRIJINDAL}}
# - run: rm lib/firebase_options.dart
# - run: flutterfire configure -y --platforms=windows --ios-bundle-id=com.prijindal.habbit-tracker --macos-bundle-id=com.prijindal.habbit-tracker --web-app-id=1:739292996360:web:5c24f4c3b47c73559e82bd --android-package-name=com.prijindal.habbit_tracker --windows-app-id=1:739292996360:web:5c24f4c3b47c73559e82bd
# env:
# GOOGLE_APPLICATION_CREDENTIALS: google-application-credentials.json
- run: flutter build windows --release
- uses: actions/upload-artifact@v4
with:
name: windows
path: build/windows/x64/runner/Release
retention-days: 1