-
-
Notifications
You must be signed in to change notification settings - Fork 619
370 lines (318 loc) · 10.4 KB
/
build-and-release.yml
File metadata and controls
370 lines (318 loc) · 10.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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
name: Build and Release App
on:
release:
types: [published]
workflow_dispatch: # Ability to manually trigger the workflow
inputs:
tag:
description: "Tag name for the release" # used when running manually
required: true
type: string
jobs:
build-server-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
pip uninstall -y onnxruntime
pip install onnxruntime-directml
- name: Build executable with PyInstaller
run: |
cd backend
pyinstaller PictoPy.spec
- name: Verify no .onnx artifacts
shell: pwsh
run: |
$onnxFiles = Get-ChildItem -Path "backend/dist/PictoPy_Server" -Recurse -Filter "*.onnx" -File
if ($onnxFiles) {
Write-Error "Found bundled .onnx artifacts in backend/dist/PictoPy_Server:"
$onnxFiles | ForEach-Object { Write-Error $_.FullName }
exit 1
}
- name: Create ZIP package
run: |
cd backend/dist/PictoPy_Server
tar -a -c -f PictoPy-Windows.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Windows
path: backend/dist/PictoPy_Server/PictoPy-Windows.zip
build-server-ubuntu:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
pip uninstall -y onnxruntime
pip install onnxruntime-gpu
- name: Build executable with PyInstaller
run: |
cd backend
pyinstaller PictoPy.spec
- name: Verify no .onnx artifacts
shell: bash
run: |
onnx_files=$(find backend/dist/PictoPy_Server -type f -name "*.onnx")
if [ -n "$onnx_files" ]; then
echo "Found bundled .onnx artifacts in backend/dist/PictoPy_Server:"
echo "$onnx_files"
exit 1
fi
- name: Create ZIP package
run: |
cd backend/dist/PictoPy_Server
zip -r PictoPy-Ubuntu.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Ubuntu
path: backend/dist/PictoPy_Server/PictoPy-Ubuntu.zip
build-server-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd backend
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build executable with PyInstaller
run: |
cd backend
pyinstaller PictoPy.spec
- name: Verify no .onnx artifacts
shell: bash
run: |
onnx_files=$(find backend/dist/PictoPy_Server -type f -name "*.onnx")
if [ -n "$onnx_files" ]; then
echo "Found bundled .onnx artifacts in backend/dist/PictoPy_Server:"
echo "$onnx_files"
exit 1
fi
- name: Create ZIP package
run: |
cd backend/dist/PictoPy_Server
zip -r PictoPy-MacOS.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-MacOS
path: backend/dist/PictoPy_Server/PictoPy-MacOS.zip
build-sync-microservice-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd sync-microservice
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable with PyInstaller
run: |
cd sync-microservice
pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist
- name: Copy app folder
run: |
cd sync-microservice
robocopy app dist\PictoPy_Sync\app /e
if ($LASTEXITCODE -le 1) { exit 0 }
- name: Create ZIP package
run: |
cd sync-microservice/dist/PictoPy_Sync
tar -a -c -f PictoPy-Sync-Windows.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Sync-Windows
path: sync-microservice/dist/PictoPy_Sync/PictoPy-Sync-Windows.zip
build-sync-microservice-ubuntu:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd sync-microservice
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable with PyInstaller
run: |
cd sync-microservice
pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist
- name: Copy app folder
run: |
cd sync-microservice
mkdir -p dist/PictoPy_Sync/app
cp -r app/* dist/PictoPy_Sync/app/
- name: Create ZIP package
run: |
cd sync-microservice/dist/PictoPy_Sync
zip -r PictoPy-Sync-Ubuntu.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Sync-Ubuntu
path: sync-microservice/dist/PictoPy_Sync/PictoPy-Sync-Ubuntu.zip
build-sync-microservice-macos:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
run: |
cd sync-microservice
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build executable with PyInstaller
run: |
cd sync-microservice
pyinstaller main.py --name PictoPy_Sync --onedir --distpath dist
- name: Copy app folder
run: |
cd sync-microservice
mkdir -p dist/PictoPy_Sync/app
cp -r app/* dist/PictoPy_Sync/app/
- name: Create ZIP package
run: |
cd sync-microservice/dist/PictoPy_Sync
zip -r PictoPy-Sync-MacOS.zip .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: PictoPy-Sync-MacOS
path: sync-microservice/dist/PictoPy_Sync/PictoPy-Sync-MacOS.zip
publish-tauri:
permissions:
contents: write
needs:
[
build-server-windows,
build-server-ubuntu,
build-server-macos,
build-sync-microservice-windows,
build-sync-microservice-ubuntu,
build-sync-microservice-macos,
]
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest"
# Enable CI feature so prod() spawns backend + sync in release builds
args: "--target aarch64-apple-darwin --features ci"
server-artifact: "PictoPy-MacOS"
sync-artifact: "PictoPy-Sync-MacOS"
- platform: "ubuntu-22.04"
args: "--features ci"
server-artifact: "PictoPy-Ubuntu"
sync-artifact: "PictoPy-Sync-Ubuntu"
- platform: "windows-latest"
args: "--features ci"
server-artifact: "PictoPy-Windows"
sync-artifact: "PictoPy-Sync-Windows"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Create dist directories
shell: bash
run: |
mkdir -p backend/dist
mkdir -p sync-microservice/dist
- name: Download and extract server artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.server-artifact }}
path: backend/dist
- name: Download and extract sync microservice artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.sync-artifact }}
path: sync-microservice/dist
- name: Extract server files
shell: bash
run: |
cd backend/dist
unzip -o *.zip
rm *.zip
ls -l
- name: Extract sync microservice files
shell: bash
run: |
cd sync-microservice/dist
unzip -o *.zip
rm *.zip
ls -l
- name: Copy utils folder
shell: bash
run: |
cp -r utils backend/dist/utils
cp -r utils sync-microservice/dist/utils
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin' || '' }}
- name: Install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: Install frontend dependencies
run: |
cd frontend
npm install
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY}}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
projectPath: ./frontend
tagName: ${{ github.event.release.tag_name || github.event.inputs.tag }}
includeUpdaterJson: true
releaseId: ${{ github.event.release.id || '' }}
releaseDraft: false
prerelease: false
args: ${{ matrix.args }}