-
Notifications
You must be signed in to change notification settings - Fork 7
352 lines (298 loc) · 11.4 KB
/
main.yml
File metadata and controls
352 lines (298 loc) · 11.4 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
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
name: Flutter CI
on:
push:
tags:
- '*'
env:
windows_build_output_path: "build/windows/x64/runner/Release/*"
macos_build_output_path: "build/macos/Build/Products/Release/TriOS.app"
linux_build_output_path: "build/linux/x64/release/bundle"
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version-file: pubspec.yaml
architecture: x64
cache: true
- run: flutter --version
- run: flutter pub get
- name: Run tests
run: flutter test --exclude-tags local-only --reporter expanded
build-windows:
needs: test
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Remove Non-Windows Files
run: |
echo "Deleting files in non-Windows asset directories..."
Get-Childitem assets/linux -File -Recurse | Foreach-Object {Write-Output "Deleting: $_.FullName"; Remove-Item $_.FullName -Force}
Get-Childitem assets/macos -File -Recurse | Foreach-Object {Write-Output "Deleting: $_.FullName"; Remove-Item $_.FullName -Force}
echo "Non-Windows asset files deleted."
- name: Flutter Setup
run: echo "Setting up Flutter..."
- uses: subosito/flutter-action@v2
with:
flutter-version-file: pubspec.yaml
architecture: x64
cache: true
- run: flutter --version
- run: flutter clean
- run: flutter config --enable-windows-desktop
# Use Visual C++ 2019 toolset so that the WebView doesn't crash on Windows 10
- name: Set up Visual Studio 2019
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
toolset: 14.29
vcvars_ver: 14.29
- name: Build Windows
run: |
echo "Building Windows app..."
flutter build windows --no-tree-shake-icons
echo "Build complete."
- name: Prepare TriOS Directory
run: |
echo "Preparing directory for Windows artifact..."
mkdir TriOS
- name: Move Build Output to TriOS Directory
run: |
echo "Moving build output to TriOS directory..."
Get-ChildItem ${{ env.windows_build_output_path }} | Move-Item -Destination TriOS/
echo "Move complete. Listing contents of the TriOS directory:"
dir
- name: Zip TriOS Directory
run: |
echo "Zipping Windows artifact..."
Compress-Archive -Path TriOS -DestinationPath TriOS-Windows.zip
echo "Zipping complete. Listing contents of the workspace:"
dir
- name: Upload Windows Artifact
uses: actions/upload-artifact@v4
with:
name: built-windows
path: TriOS-Windows.zip
build-macos-intel:
needs: test
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v4
- name: Remove Non-macOS Files
run: |
echo "Deleting files in non-macOS asset directories..."
find assets/windows/ -type f -exec echo "Deleting: {}" \; -exec rm -f {} \;
find assets/linux/ -type f -exec echo "Deleting: {}" \; -exec rm -f {} \;
echo "Non-macOS asset files deleted."
- name: Flutter Setup
run: echo "Setting up Flutter..."
- uses: subosito/flutter-action@v2
with:
flutter-version-file: pubspec.yaml
architecture: x64
cache: true
- run: flutter --version
- run: flutter config --enable-macos-desktop
- name: Build macOS (Intel)
run: |
echo "Building macOS Intel app..."
flutter build macos --no-tree-shake-icons
echo "Build complete. Listing contents of the output directory:"
ls -l ${{ env.macos_build_output_path }}
- name: Zip macOS Intel Artifact
run: |
echo "Zipping macOS Intel artifact..."
cd $(dirname ${{ env.macos_build_output_path }})
pwd
ls -l
zip -yr9 $GITHUB_WORKSPACE/TriOS-MacOS-Intel.zip $(basename ${{ env.macos_build_output_path }})
echo "Zipping complete. Listing contents of the workspace:"
ls -l $GITHUB_WORKSPACE
- name: Upload macOS Intel Artifact
uses: actions/upload-artifact@v4
with:
name: built-macos-intel
path: TriOS-MacOS-Intel.zip
build-macos-arm:
needs: test
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Remove Non-macOS Files
run: |
echo "Deleting files in non-macOS asset directories..."
find assets/windows/ -type f -exec echo "Deleting: {}" \; -exec rm -f {} \;
find assets/linux/ -type f -exec echo "Deleting: {}" \; -exec rm -f {} \;
echo "Non-macOS asset files deleted."
- name: Flutter Setup
run: echo "Setting up Flutter..."
- uses: subosito/flutter-action@v2
with:
flutter-version-file: pubspec.yaml
architecture: arm64
cache: true
- run: flutter --version
- run: flutter config --enable-macos-desktop
- name: Build macOS (Apple Silicon)
run: |
echo "Building macOS Apple Silicon app..."
flutter build macos --no-tree-shake-icons
echo "Build complete. Listing contents of the output directory:"
ls -l ${{ env.macos_build_output_path }}
- name: Zip macOS Apple Silicon Artifact
run: |
echo "Zipping macOS Apple Silicon artifact..."
cd $(dirname ${{ env.macos_build_output_path }})
pwd
ls -l
zip -yr9 $GITHUB_WORKSPACE/TriOS-MacOS-AppleSilicon.zip $(basename ${{ env.macos_build_output_path }})
echo "Zipping complete. Listing contents of the workspace:"
ls -l $GITHUB_WORKSPACE
- name: Upload macOS Apple Silicon Artifact
uses: actions/upload-artifact@v4
with:
name: built-macos-arm
path: TriOS-MacOS-AppleSilicon.zip
build-linux:
needs: test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Remove Non-Linux Files
run: |
echo "Deleting files in non-Linux asset directories..."
find assets/windows/ -type f -exec echo "Deleting: {}" \; -exec rm -f {} \;
find assets/macos/ -type f -exec echo "Deleting: {}" \; -exec rm -f {} \;
echo "Non-Linux asset files deleted."
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y ninja-build cmake g++ libgtk-3-dev libcurl4-openssl-dev default-jdk
- name: Flutter Setup
run: echo "Setting up Flutter..."
- uses: subosito/flutter-action@v2
with:
flutter-version-file: pubspec.yaml
architecture: x64
cache: true
- run: flutter --version
- run: flutter config --enable-linux-desktop
- name: Build Linux
run: |
echo "Building Linux app..."
flutter clean
flutter pub get
find -L . -type f -name "CMakeLists.txt" -exec sed -i 's/-Wno-deprecated-literal-operator//g' {} + 2>/dev/null || true
flutter build linux --no-tree-shake-icons
echo "Build complete. Listing contents of the output directory:"
ls -l ${{ env.linux_build_output_path }}
- name: Zip Linux Artifact
run: |
echo "Zipping Linux artifact..."
cd $(dirname ${{ env.linux_build_output_path }})
mkdir TriOS
cp -r $(basename ${{ env.linux_build_output_path }})/* TriOS/
pwd
ls -l
zip -yr9 $GITHUB_WORKSPACE/TriOS-Linux.zip TriOS
echo "Zipping complete. Listing contents of the workspace:"
ls -l $GITHUB_WORKSPACE
- name: Upload Linux Artifact
uses: actions/upload-artifact@v4
with:
name: built-linux
path: TriOS-Linux.zip
create-release:
runs-on: ubuntu-latest
needs: [ build-macos-intel, build-macos-arm, build-windows, build-linux ]
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Fetch Tags
run: git fetch --prune --unshallow --tags
- name: Set Variables
run: |
echo "Setting version based on git tags..."
echo "VERSION=$(git describe --tags)" >> $GITHUB_ENV
git log --format=%B -n 1 $(git log -1 --pretty=format:"%h") | cat - > changes.txt
echo "Generated changes.txt:"
cat changes.txt
prerelease_regex=".*(dev|qa|rc|prerelease|unstable|preview).*"
if [[ "$(git describe --tags)" =~ $prerelease_regex ]]; then
echo "IS_PRERELEASE=true" >> $GITHUB_ENV;
echo "This is a pre-release."
else
echo "IS_PRERELEASE=false" >> $GITHUB_ENV;
echo "This is a stable release."
fi
- name: 'Create GitHub release from a tag'
id: create_release
uses: ncipollo/release-action@v1
with:
commit: '${{ github.sha }}'
name: ${{ env.VERSION }}
tag: ${{ env.VERSION }}
bodyFile: changes.txt
draft: false
prerelease: '${{ env.IS_PRERELEASE }}'
- name: Download Built Artifacts From Jobs
uses: actions/download-artifact@v4
with:
path: uploads
pattern: built-*
merge-multiple: true
- name: List Files Before Uploading macOS Artifacts
run: |
echo "Listing files in the uploads directory:"
ls -l uploads/
- name: Upload macOS Intel Artifact
id: upload-macos-intel
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./uploads/TriOS-MacOS-Intel.zip
asset_name: TriOS-MacOS-Intel.zip
asset_content_type: application/zip
- name: Upload macOS Apple Silicon Artifact
id: upload-macos-arm
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./uploads/TriOS-MacOS-AppleSilicon.zip
asset_name: TriOS-MacOS-AppleSilicon.zip
asset_content_type: application/zip
- name: List Files Before Uploading Windows Artifact
run: |
echo "Listing files in the current directory:"
ls -l
- name: Upload Windows Artifact
id: upload-windows
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./uploads/TriOS-Windows.zip
asset_name: TriOS-Windows.zip
asset_content_type: application/zip
- name: List Files Before Uploading Linux Artifact
run: |
echo "Listing files in the current directory:"
ls -l
- name: Upload Linux Artifact
id: upload-linux
uses: shogo82148/actions-upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./uploads/TriOS-Linux.zip
asset_name: TriOS-Linux.zip
asset_content_type: application/zip