-
Notifications
You must be signed in to change notification settings - Fork 12
308 lines (252 loc) · 9.53 KB
/
release.yaml
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
name: release
on:
push:
branches:
- release
paths:
- "pubspec.yaml"
- ".github/workflows/release.yaml"
jobs:
changelog:
name: 📜 Create changelog
runs-on: ubuntu-latest
timeout-minutes: 3
outputs:
changelog: ${{ steps.build_changelog.outputs.changelog }}
steps:
- name: Checks-out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4.2.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configuration: ".github/workflows/actions_settings/changelog_config.json"
build-android-linux:
name: 🤖 Build Android and Linux apps
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checks-out repository
uses: actions/checkout@v4
- name: Read pubspec.yaml version
uses: KJ002/read-yaml@1.6
id: pubspec-data
with:
file: "pubspec.yaml"
key-path: '["version"]'
- name: Generate unique Release Tag
run: echo RELEASE_TAG=${{ steps.pubspec-data.outputs.data }} | cut -f1 -d"+" >> $GITHUB_ENV
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: "zulu"
java-version: "18"
- name: Update Linux dependencies
run: sudo apt-get update -y
- name: Pre install libunwind
run: sudo apt install -y libunwind-dev
- name: Install new Linux dependencies
run: sudo apt-get --assume-yes --fix-missing install libgles2-mesa-dev clang cmake unzip curl ninja-build pkg-config libgtk-3-dev liblzma-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libsecret-1-dev libjsoncpp-dev libsecret-1-0
- name: Install Flutter
uses: subosito/flutter-action@v2.16.0
with:
cache: true
- name: Enable Linux
run: flutter config --enable-linux-desktop
- name: Install app dependencies
run: flutter pub get
- name: Build Linux app
run: flutter build linux --release
- name: Compress Linux app
uses: papeloto/action-zip@v1
with:
files: ./build/linux/x64/release/bundle/
dest: ./colors-ai-linux.zip
- name: Decode key.properties
run: echo "${{ secrets.KEY_PROPERTIES_BASE64 }}" | base64 --decode > android/key.properties
- name: Decode key.jks
run: echo "${{ secrets.KEYSTORE_JKS_BASE64 }}" | base64 --decode > android/app/key.jks
- name: Build Android app
run: flutter build appbundle --release && flutter build apk --split-per-abi --release
- name: Rename APKs
run: |
mv ./build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk ./build/app/outputs/flutter-apk/colors-ai-armeabi-v7a.apk
mv ./build/app/outputs/flutter-apk/app-arm64-v8a-release.apk ./build/app/outputs/flutter-apk/colors-ai-arm64-v8a.apk
mv ./build/app/outputs/flutter-apk/app-x86_64-release.apk ./build/app/outputs/flutter-apk/colors-ai-x86_64.apk
- name: Create Github Release
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/colors-ai-armeabi-v7a.apk,build/app/outputs/flutter-apk/colors-ai-arm64-v8a.apk,build/app/outputs/flutter-apk/colors-ai-x86_64.apk,colors-ai-linux.zip"
body: "${{ github.event.head_commit.message }}"
token: ${{ secrets.GH_TOKEN }}
tag: "${{ env.RELEASE_TAG }}"
allowUpdates: true
- name: Save AAB to Artifacts
uses: actions/upload-artifact@v4
with:
name: APPBUNDLE
path: build/app/outputs/bundle/release/app-release.aab
build-windows:
runs-on: windows-latest
needs: build-android-linux
name: 🖥️ Build Windows app
timeout-minutes: 15
steps:
- name: Checks-out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest release tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- name: Install Flutter
uses: subosito/flutter-action@v2.16.0
with:
cache: true
- name: Enable Windows
run: flutter config --enable-windows-desktop
- name: Install app dependencies
run: flutter pub get
- name: Build Windows app
run: flutter build windows --release
- name: Create MSIX package
run: flutter pub run msix:create
- name: Save MSIX to Artifacts
uses: actions/upload-artifact@v4
with:
name: windows-release-build
path: build\windows\runner\Release\colors_ai.msix
retention-days: 1
- name: Copy VC redistributables
run: |
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\msvcp140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140.dll') .
Copy-Item (vswhere -latest -find 'VC\Redist\MSVC\*\x64\*\vcruntime140_1.dll') .
working-directory: ./build/windows/runner/Release
- name: Compress Windows app
uses: papeloto/action-zip@v1
with:
files: ./build/windows/runner/Release/
dest: ./colors-ai-windows.zip
- name: Update Releases with Windows app
uses: djnicholson/release-action@v2.11
with:
token: ${{ secrets.GH_TOKEN }}
tag-name: "${{ steps.previoustag.outputs.tag }}"
asset-name: "colors-ai-windows.zip"
file: "colors-ai-windows.zip"
build-apple:
name: 🍏 Build macOS and iOS apps
needs: build-android-linux
runs-on: macos-latest
steps:
- name: Checks-out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest release tag
id: previoustag
uses: WyriHaximus/github-action-get-previous-tag@v1
- name: Install Flutter
uses: subosito/flutter-action@v2.16.0
with:
cache: true
- name: Enable macOS
run: flutter config --enable-macos-desktop
- name: Install app dependencies
run: flutter pub get
- name: Build iOS app
run: flutter build ios --release --no-codesign
- name: Compress iOS app
run: |
mkdir -p colors-ai
mv ./build/ios/iphoneos/Runner.app colors-ai
zip -r -y colors-ai.zip colors-ai/Runner.app
mv colors-ai.zip colors-ai-ios.ipa
- name: Update Releases with iOS app
uses: djnicholson/release-action@v2.11
with:
token: ${{ secrets.GH_TOKEN }}
tag-name: "${{ steps.previoustag.outputs.tag }}"
asset-name: "colors-ai-ios.ipa"
file: "colors-ai-ios.ipa"
# TODO: Provide macOS builds in Releases too.
# - name: Build macOS app
# run: flutter build macos
# - name: Compress macOS app
# run: zip -r colors-ai-macos.zip build/macos/Build/Products/Debug
# - name: Update Releases with macOS app
# uses: djnicholson/release-action@v2.11
# with:
# token: ${{ secrets.GH_TOKEN }}
# tag-name: "${{ steps.previoustag.outputs.tag }}"
# asset-name: "colors-ai-macos.zip"
# file: "colors-ai-macos.zip"
publish-on-google-play:
name: 🏬 Publish app in Google Play Store
needs: [build-android-linux, changelog]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checks-out repository
uses: actions/checkout@v4
- name: Get AAB from Artifacts
uses: actions/download-artifact@v4
with:
name: APPBUNDLE
- name: Create "whatsnew" directory
run: mkdir whatsnew
- name: Put changelog in "whatsnew" directory
run: echo "${{ needs.changelog.outputs.changelog }}" > whatsnew/whatsnew-en-US
- name: Release AAB to Google Play Store
uses: r0adkll/upload-google-play@v1
with:
serviceAccountJsonPlainText: ${{ secrets.PLAYSTORE_ACCOUNT_KEY }}
packageName: ${{ secrets.APP_PACKAGE_NAME }}
releaseFiles: app-release.aab
whatsNewDirectory: whatsnew
track: production
status: draft
publish-on-windows-store:
needs: build-windows
runs-on: ubuntu-latest
name: 🏪 Publish app in Microsoft Store
timeout-minutes: 15
steps:
- uses: actions/download-artifact@v4
name: Download Release
with:
name: windows-release-build
path: "${{ github.workspace }}/release"
- uses: isaacrlevin/windows-store-action@1.0
name: Publish to Store
with:
tenant-id: ${{ secrets.AZURE_AD_TENANT_ID }}
client-id: ${{ secrets.AZURE_AD_APPLICATION_CLIENT_ID }}
client-secret: ${{ secrets.AZURE_AD_APPLICATION_SECRET }}
app-id: ${{ secrets.WINDOWS_STORE_APP_ID }}
package-path: "${{ github.workspace }}/release"
publish-on-snapcraft:
name: 🛍️ Build Snap and Publish to Snap Store
needs: build-android-linux
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checks-out repository
uses: actions/checkout@v4
- name: Move Snap directory to root
run: mv linux/snap .
- name: Build Snap
uses: snapcore/action-build@v1.2.0
id: snapcraft
- name: 🚀 Publish to Snap Store
uses: snapcore/action-publish@v1.2.0
env:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_LOGIN }}
with:
snap: ${{ steps.snapcraft.outputs.snap }}
release: edge