-
-
Notifications
You must be signed in to change notification settings - Fork 14
318 lines (266 loc) · 9.32 KB
/
flutter_build_release.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
name: Flutter Build Release
on:
push:
branches:
- main
tags:
- '*'
env:
FLUTTER_VERSION: '3.13.4'
IS_PRERELEASE: ${{ startsWith(github.ref, 'refs/tags/') && 'false' || 'true' }}
RELEASE_TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || 'latest' }}
jobs:
cancel:
name: Cancel Previous Runs
runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
android:
needs: cancel
name: Build APK
runs-on: ubuntu-latest
env:
FLUTTER_KEY_ALIAS: ${{ secrets.FLUTTER_KEY_ALIAS }}
FLUTTER_KEY_PASSWORD: ${{ secrets.FLUTTER_KEY_PASSWORD }}
FLUTTER_STORE_PASSWORD: ${{ secrets.FLUTTER_STORE_PASSWORD }}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache Flutter SDK and dependencies
uses: actions/cache@v2
with:
path: |
~/.pub-cache
~/.flutter
key: ${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Decode Keystore
run: echo "${{ secrets.FLUTTER_STORE_FILE }}" | base64 -d > android/app/release-key.jks
- name: Install Dependencies
run: flutter pub get
- name: Build APK
run: |
flutter build apk --release
#- name: Decode Keystore
# run: echo "${{ secrets.KEYSTORE }}" | base64 -d > release-key.jks
# - name: Build APK
# run: |
# flutter build apk --release \
# --dart-define=android-signing-keystore=release-key.jks \
# --dart-define=android-signing-key-alias=${{ secrets.KEY_ALIAS }} \
# --dart-define=android-signing-key-password=${{ secrets.KEY_PASSWORD }} \
# --dart-define=android-signing-keystore-password=${{ secrets.KEYSTORE_PASSWORD }}
#mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/app-signed.apk
- name: Upload APKs as Artifact
uses: actions/upload-artifact@v2
with:
name: apk-artifacts
path: |
build/app/outputs/flutter-apk/app-release.apk
ios:
needs: cancel
name: Build iOS
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Cache Flutter SDK and dependencies
uses: actions/cache@v2
with:
path: |
~/.pub-cache
~/Library/Caches/com.google.dart.tools.sdk
~/.flutter
key: ${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install Dependencies
run: flutter pub get
- name: Build iOS
run: flutter build ios --release --no-codesign
- name: Archive iOS app
run: tar -czf build/ios/iphoneos/ios_unsigned.app.tar.gz build/ios/iphoneos/Runner.app
- name: Upload iOS app as Artifact
uses: actions/upload-artifact@v2
with:
name: ios-artifact
path: build/ios/iphoneos/ios_unsigned.app.tar.gz
linux:
needs: cancel
name: Build Linux
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Cache Flutter SDK
uses: actions/cache@v2
with:
path: |
~/.pub-cache
~/.flutter
key: ${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
clang \
cmake \
ninja-build \
pkg-config \
libgtk-3-dev \
libunwind-dev \
liborc-dev \
liblzma-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-libav \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-ugly \
libgstreamer1.0-dev \
libgstreamer-plugins-base1.0-dev \
libpangocairo-1.0-0 \
libpango-1.0-0 \
libharfbuzz0b \
libatk1.0-0 \
libcairo-gobject2 \
libcairo2
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install Dependencies
run: flutter pub get
- name: Build Linux Executable
run: |
flutter build linux --release
- name: Create AppImage
run: |
sudo apt-get update
sudo apt-get install -y libfuse2
# Download appimagetool from GitHub
wget "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
chmod a+x appimagetool-x86_64.AppImage
# Make Appdir
cp -r build/linux/x64/release/bundle InnerBreeze.AppDir
# Add the AppRun script
echo -e '#!/bin/bash\ncurrent_dir="$(dirname "$(readlink -f "$0")")"\n"$current_dir/inner_breeze"' > InnerBreeze.AppDir/AppRun
chmod +x InnerBreeze.AppDir/AppRun
cat > InnerBreeze.AppDir/InnerBreeze.desktop <<EOF
[Desktop Entry]
Type=Application
Name=InnerBreeze
Comment=A dedicated meditation app to guide and track your Wim Hof Breathing practice.
Exec=AppRun
Icon=InnerBreeze
Terminal=false
Version=1.5
Categories=Utility;Education;
Keywords=Meditation;Breathing;Relaxation;Focus;Wellness;
StartupNotify=true
EOF
cp InnerBreeze.AppDir/data/flutter_assets/assets/images/logo.png InnerBreeze.AppDir/InnerBreeze.png
./appimagetool-x86_64.AppImage InnerBreeze.AppDir
- name: Archive Linux executable
run: |
mkdir -p organized_output/InnerBreeze-x86_64/
mv build/linux/x64/release/bundle/* organized_output/InnerBreeze-x86_64/
cp -r metadata organized_output/InnerBreeze-x86_64/
cd organized_output
tar -czf ../InnerBreeze-Linux-x86_64.tar.gz InnerBreeze-x86_64/
- name: Upload Linux Artifacts
uses: actions/upload-artifact@v2
with:
name: linux-artifacts
path: |
InnerBreeze-Linux-x86_64.tar.gz
InnerBreeze-x86_64.AppImage
windows:
needs: cancel
name: Build Windows
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Cache Flutter SDK
uses: actions/cache@v2
with:
path: |
~\AppData\Local\Pub\Cache
~\AppData\Local\Flutter
key: ${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install Dependencies
run: flutter pub get
- name: Build Windows Executable
run: flutter build windows --release
- name: Reorganize Windows Directory
run: |
mkdir -p organized_output/windows/
cp -r build/windows/runner/Release/* organized_output/windows/
- name: Archive Windows executable
run: 7z a build/InnerBreeze-Windows-x86_64.zip organized_output/windows/
- name: Upload Windows executable as Artifact
uses: actions/upload-artifact@v2
with:
name: windows-artifact
path: build/InnerBreeze-Windows-x86_64.zip
release:
name: Release Builds
needs: [android, ios, linux, windows]
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Download APK Artifact
uses: actions/download-artifact@v2
with:
name: apk-artifacts
path: build/app/outputs/flutter-apk/
- name: Download iOS Artifact
uses: actions/download-artifact@v2
with:
name: ios-artifact
path: build/ios/iphoneos/
- name: Download Linux Artifacts
uses: actions/download-artifact@v2
with:
name: linux-artifacts
path: build/linux/
- name: Download Windows Artifact
uses: actions/download-artifact@v2
with:
name: windows-artifact
path: build/windows/
- name: Create Release and Upload Builds
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "${{ env.RELEASE_TAG }}"
prerelease: "${{ env.IS_PRERELEASE }}"
title: "${{ env.RELEASE_TAG }}"
files: |
build/app/outputs/flutter-apk/app-release.apk
build/ios/iphoneos/ios_unsigned.app.tar.gz
build/linux/InnerBreeze-Linux-x86_64.tar.gz
build/linux/InnerBreeze-x86_64.AppImage
build/windows/InnerBreeze-Windows-x86_64.zip