-
Notifications
You must be signed in to change notification settings - Fork 0
260 lines (238 loc) · 10 KB
/
desktop-release.yml
File metadata and controls
260 lines (238 loc) · 10 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
name: Desktop build & release (Tauri)
on:
push:
branches: [main]
paths:
- 'web/**'
- 'api/desktop_vinted_server.py'
- 'api/desktop_vinted_server.spec'
- 'api/desktop_amazon_server.py'
- 'api/desktop_amazon_server.spec'
- 'api/desktop_cardmarket_server.py'
- 'api/desktop_cardmarket_server.spec'
- 'api/worker_bundled.env'
- 'api/worker_env_bootstrap.py'
- '.github/workflows/desktop-release.yml'
workflow_dispatch:
concurrency:
group: goupixdex-desktop-${{ github.ref }}
cancel-in-progress: true
jobs:
build-desktop:
name: Build desktop (${{ matrix.platform }})
# Avoid the "JS actions on Node 20" warning (GitHub runner now on Node 24).
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
# macOS Intel: Tauri cross-compile from ARM runner; install x86_64 Python
# (runs via Rosetta 2, preinstalled on macos-latest) so PyInstaller
# builds a native Intel sidecar. Avoids the endless queue on macos-13.
- platform: macos-latest
args: --target x86_64-apple-darwin
rust_triple: x86_64-apple-darwin
python_arch: x64
- platform: macos-latest
args: --target aarch64-apple-darwin
rust_triple: aarch64-apple-darwin
python_arch: arm64
- platform: windows-latest
args: ""
rust_triple: x86_64-pc-windows-msvc
python_arch: x64
runs-on: ${{ matrix.platform }}
defaults:
run:
working-directory: web
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '24'
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install pnpm
uses: pnpm/action-setup@v5
with:
version: 10
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install macOS Rust targets
if: startsWith(matrix.platform, 'macos')
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Setup Python 3.11
uses: actions/setup-python@v6
with:
python-version: '3.11'
architecture: ${{ matrix.python_arch }}
- name: Install Python deps + PyInstaller
shell: bash
working-directory: api
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller==6.11.1
python -c "import platform, sys; print('Python', sys.version, 'arch=', platform.machine())"
# Optional GitHub secrets override bundled defaults (same keys as worker_bundled.env).
- name: Write worker_bundled.env for PyInstaller
shell: bash
working-directory: api
env:
VINTED_BROWSER_HEADLESS: ${{ secrets.VINTED_DESKTOP_BROWSER_HEADLESS }}
VINTED_BROWSER_DISCREET: ${{ secrets.VINTED_DESKTOP_BROWSER_DISCREET }}
VINTED_BROWSER_DISCREET_MINIMIZE: ${{ secrets.VINTED_DESKTOP_BROWSER_DISCREET_MINIMIZE }}
VINTED_BROWSER_DISCREET_X: ${{ secrets.VINTED_DESKTOP_BROWSER_DISCREET_X }}
VINTED_BROWSER_DISCREET_Y: ${{ secrets.VINTED_DESKTOP_BROWSER_DISCREET_Y }}
run: |
set -euo pipefail
headless="${VINTED_BROWSER_HEADLESS:-false}"
discreet="${VINTED_BROWSER_DISCREET:-false}"
minimize="${VINTED_BROWSER_DISCREET_MINIMIZE:-false}"
x="${VINTED_BROWSER_DISCREET_X:-0}"
y="${VINTED_BROWSER_DISCREET_Y:-0}"
{
echo "VINTED_BROWSER_HEADLESS=${headless}"
echo "VINTED_BROWSER_DISCREET=${discreet}"
echo "VINTED_BROWSER_DISCREET_MINIMIZE=${minimize}"
echo "VINTED_BROWSER_DISCREET_X=${x}"
echo "VINTED_BROWSER_DISCREET_Y=${y}"
} > worker_bundled.env
echo "--- worker_bundled.env (desktop sidecar) ---"
cat worker_bundled.env
- name: Build Vinted local worker (PyInstaller)
shell: bash
working-directory: api
env:
MATRIX_TRIPLE: ${{ matrix.rust_triple }}
run: |
set -e
pyinstaller desktop_vinted_server.spec --noconfirm --clean
mkdir -p ../web/src-tauri/binaries
if [[ "$RUNNER_OS" == "Windows" ]]; then
mv "dist/goupix-vinted-worker.exe" \
"../web/src-tauri/binaries/goupix-vinted-worker-${MATRIX_TRIPLE}.exe"
else
mv "dist/goupix-vinted-worker" \
"../web/src-tauri/binaries/goupix-vinted-worker-${MATRIX_TRIPLE}"
chmod +x "../web/src-tauri/binaries/goupix-vinted-worker-${MATRIX_TRIPLE}"
# Verify produced arch matches the Tauri target
file "../web/src-tauri/binaries/goupix-vinted-worker-${MATRIX_TRIPLE}" || true
fi
ls -la "../web/src-tauri/binaries/"
- name: Build Amazon local worker (PyInstaller)
shell: bash
working-directory: api
env:
MATRIX_TRIPLE: ${{ matrix.rust_triple }}
run: |
set -e
pyinstaller desktop_amazon_server.spec --noconfirm --clean
if [[ "$RUNNER_OS" == "Windows" ]]; then
mv "dist/goupix-amazon-worker.exe" \
"../web/src-tauri/binaries/goupix-amazon-worker-${MATRIX_TRIPLE}.exe"
else
mv "dist/goupix-amazon-worker" \
"../web/src-tauri/binaries/goupix-amazon-worker-${MATRIX_TRIPLE}"
chmod +x "../web/src-tauri/binaries/goupix-amazon-worker-${MATRIX_TRIPLE}"
file "../web/src-tauri/binaries/goupix-amazon-worker-${MATRIX_TRIPLE}" || true
fi
ls -la "../web/src-tauri/binaries/"
- name: Build Cardmarket local worker (PyInstaller)
shell: bash
working-directory: api
env:
MATRIX_TRIPLE: ${{ matrix.rust_triple }}
run: |
set -e
pyinstaller desktop_cardmarket_server.spec --noconfirm --clean
if [[ "$RUNNER_OS" == "Windows" ]]; then
mv "dist/goupix-cardmarket-worker.exe" \
"../web/src-tauri/binaries/goupix-cardmarket-worker-${MATRIX_TRIPLE}.exe"
else
mv "dist/goupix-cardmarket-worker" \
"../web/src-tauri/binaries/goupix-cardmarket-worker-${MATRIX_TRIPLE}"
chmod +x "../web/src-tauri/binaries/goupix-cardmarket-worker-${MATRIX_TRIPLE}"
file "../web/src-tauri/binaries/goupix-cardmarket-worker-${MATRIX_TRIPLE}" || true
fi
ls -la "../web/src-tauri/binaries/"
- name: Install frontend dependencies
run: npm ci
# Unique version per CI run (semver patch = run_number) for future updater / build traceability.
- name: Set desktop version for this release
shell: bash
working-directory: web
env:
RELEASE_VERSION: 0.1.${{ github.run_number }}
UPDATER_ENDPOINT: https://github.com/${{ github.repository }}/releases/latest/download/latest.json
UPDATER_PUBKEY: ${{ secrets.TAURI_UPDATER_PUBKEY }}
run: |
if [ -z "$UPDATER_PUBKEY" ]; then
echo "Secret TAURI_UPDATER_PUBKEY manquant."
exit 1
fi
python3 << 'PY'
import json, os, re
version = os.environ["RELEASE_VERSION"]
updater_endpoint = os.environ["UPDATER_ENDPOINT"]
updater_pubkey = os.environ["UPDATER_PUBKEY"]
os.chdir("src-tauri")
with open("Cargo.toml", encoding="utf-8") as f:
lines = f.read().splitlines(keepends=True)
in_package = False
out = []
for line in lines:
s = line.strip()
if s == "[package]":
in_package = True
elif s.startswith("[") and s != "[package]":
in_package = False
if in_package and re.match(r"^version\s*=\s*", line):
line = f'version = "{version}"\n'
out.append(line)
with open("Cargo.toml", "w", encoding="utf-8") as f:
f.writelines(out)
with open("tauri.conf.json", encoding="utf-8") as f:
conf = json.load(f)
conf["version"] = version
conf.setdefault("bundle", {})
conf["bundle"]["createUpdaterArtifacts"] = True
conf.setdefault("plugins", {})
conf["plugins"]["updater"] = {
"endpoints": [updater_endpoint],
"pubkey": updater_pubkey
}
with open("tauri.conf.json", "w", encoding="utf-8") as f:
json.dump(conf, f, indent=2, ensure_ascii=False)
f.write("\n")
print(f"Desktop version set to {version}")
PY
- name: Sync Cargo.lock for new desktop version
working-directory: web/src-tauri
run: cargo update -p goupixdex-desktop
- name: Build and publish desktop artifacts
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUXT_PUBLIC_API_BASE: ${{ secrets.NUXT_PUBLIC_API_BASE }}
NUXT_PUBLIC_GITHUB_REPO: ${{ github.repository }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
projectPath: web
tagName: v0.1.${{ github.run_number }}
releaseName: "GoupixDex Desktop v0.1.${{ github.run_number }}"
releaseBody: |
Build **production** Windows / macOS (Rust `--release`, pas de console cmd au lancement sur Windows).
Installeurs : voir les assets de cette version (.exe, .msi, .dmg).
**Version appli :** `0.1.${{ github.run_number }}` (semver patch = numéro de run GitHub Actions, unique à chaque build sur `main`).
releaseDraft: false
prerelease: false
args: ${{ matrix.args }}