-
Notifications
You must be signed in to change notification settings - Fork 156
205 lines (174 loc) · 5.79 KB
/
app-build.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
name: Build and Release
on:
push:
branches:
- "main"
paths:
- "backend/**"
- "frontend/**"
workflow_dispatch: # Ability to manually trigger the workflow
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
- name: Build executable with PyInstaller
run: |
cd backend
pyinstaller main.py --name PictoPy_Server --onedir --distpath dist
- name: Copy app folder
run: |
cd backend
mkdir dist/PictoPy_Server/images
robocopy app dist\PictoPy_Server\app /e
if ($LASTEXITCODE -le 1) { exit 0 }
- 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
- name: Build executable with PyInstaller
run: |
cd backend
pyinstaller main.py --name PictoPy_Server --onedir --distpath dist
- name: Copy app folder
run: |
cd backend
mkdir -p dist/PictoPy_Server/images
mkdir -p dist/PictoPy_Server/app
cp -r app/* dist/PictoPy_Server/app/
- 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 main.py --name PictoPy_Server --onedir --distpath dist
- name: Copy app folder
run: |
cd backend
mkdir -p dist/PictoPy_Server/images
mkdir -p dist/PictoPy_Server/app
cp -r app/* dist/PictoPy_Server/app/
- 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
publish-tauri:
permissions:
contents: write
needs: [build-server-windows, build-server-ubuntu, build-server-macos]
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest"
args: "--target aarch64-apple-darwin"
artifact: "PictoPy-MacOS"
- platform: "ubuntu-22.04"
args: ""
artifact: "PictoPy-Ubuntu"
- platform: "windows-latest"
args: ""
artifact: "PictoPy-Windows"
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Create dist directory
shell: bash
run: mkdir -p backend/dist
- name: Download and extract server artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact }}
path: backend/dist
- name: Extract server files
shell: bash
run: |
cd backend/dist
unzip -o *.zip
rm *.zip
ls -l
- 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: dW50cnVzdGVkIGNvbW1lbnQ6IHJzaWduIGVuY3J5cHRlZCBzZWNyZXQga2V5ClJXUlRZMEl5NlF2SjE3cWNXOVlQQ0JBTlNITEpOUVoyQ3ZuNTdOSkwyNE1NN2RmVWQ1a0FBQkFBQUFBQUFBQUFBQUlBQUFBQU9XOGpTSFNRd0Q4SjNSbm5Oc1E0OThIUGx6SS9lWXI3ZjJxN3BESEh1QTRiQXlkR2E5aG1oK1g0Tk5kcmFzc0IvZFZScEpubnptRkxlbDlUR2R1d1Y5OGRSYUVmUGoxNTFBcHpQZ1dSS2lHWklZVHNkV1Byd1VQSnZCdTZFWlVGOUFNVENBRlgweUU9Cg==
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: pass
with:
projectPath: ./frontend
tagName: app-v__VERSION__
releaseName: "PictoPy v__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}