-
Notifications
You must be signed in to change notification settings - Fork 0
215 lines (195 loc) · 7.13 KB
/
Copy pathrelease.yml
File metadata and controls
215 lines (195 loc) · 7.13 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
name: Release
on:
push:
tags: ["v*"]
# Manuell triggerbar damit wir Bugs ohne neuen Tag fixen koennen
workflow_dispatch:
jobs:
# ---------------------------------------------------------------------------
# Schritt 1: Backend-Tests laufen einmal zentral (auf Linux, schnellster
# Runner). Wenn die fehlschlagen, brechen wir den ganzen Release ab.
# ---------------------------------------------------------------------------
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Backend tests
working-directory: backend
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
python -m pytest -q
# ---------------------------------------------------------------------------
# Schritt 2: Bundles pro Plattform.
# - Windows: portable ZIP via pack-portable.ps1 (umgeht winCodeSign-Bug)
# - macOS/Linux: electron-builder (kein winCodeSign-Symlink-Problem)
# ---------------------------------------------------------------------------
bundle-windows:
needs: tests
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Backend bundle (PyInstaller)
working-directory: backend
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
pip install pyinstaller
python -m PyInstaller camwosa-backend.spec --clean --noconfirm
shell: pwsh
- name: Frontend build
working-directory: frontend
run: |
npm install --legacy-peer-deps --no-audit --no-fund
npm run build
shell: pwsh
- name: Electron compile
working-directory: electron
run: |
npm install --no-audit --no-fund
npm run build
shell: pwsh
- name: Portable ZIP packen
run: pwsh -File scripts/pack-portable.ps1
shell: pwsh
- name: Smoke-Test (Backend antwortet)
run: |
$exe = "$env:GITHUB_WORKSPACE\electron\dist-portable\CAMWOSA-win32-x64\CAMWOSA.exe"
if (-not (Test-Path $exe)) { throw "Bundle EXE fehlt: $exe" }
Start-Process -FilePath $exe -PassThru | Out-Null
Start-Sleep -Seconds 15
$ok = $false
foreach ($port in 8765..8770) {
try {
$r = Invoke-WebRequest -Uri "http://127.0.0.1:$port/health" -TimeoutSec 2 -ErrorAction Stop
Write-Host "Backend Port $port OK: $($r.Content)"
$ok = $true; break
} catch { }
}
Get-Process | Where-Object { $_.Name -in @('CAMWOSA','camwosa-backend','electron') } | Stop-Process -Force -ErrorAction SilentlyContinue
if (-not $ok) { throw "Bundle Backend antwortet nicht" }
shell: pwsh
- name: Upload Windows-Portable
uses: actions/upload-artifact@v4
with:
name: camwosa-windows-portable
path: electron/dist-portable/CAMWOSA-*.zip
bundle-linux:
needs: tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Backend bundle
working-directory: backend
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
pip install pyinstaller
python -m PyInstaller camwosa-backend.spec --clean --noconfirm
- name: Frontend build
working-directory: frontend
run: |
npm install --legacy-peer-deps --no-audit --no-fund
npm run build
- name: Electron build (AppImage)
working-directory: electron
run: |
npm install --no-audit --no-fund
npm run build
npx electron-builder --linux AppImage || echo "electron-builder linux failed (continuing)"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload Linux-AppImage
if: always()
uses: actions/upload-artifact@v4
with:
name: camwosa-linux-appimage
path: |
electron/dist-installer/*.AppImage
electron/dist-installer/*.deb
if-no-files-found: warn
bundle-macos:
needs: tests
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Backend bundle
working-directory: backend
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
pip install pyinstaller
python -m PyInstaller camwosa-backend.spec --clean --noconfirm
- name: Frontend build
working-directory: frontend
run: |
npm install --legacy-peer-deps --no-audit --no-fund
npm run build
- name: Electron build (DMG)
working-directory: electron
run: |
npm install --no-audit --no-fund
npm run build
npx electron-builder --mac dmg || echo "electron-builder mac failed (continuing)"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload macOS-DMG
if: always()
uses: actions/upload-artifact@v4
with:
name: camwosa-macos-dmg
path: electron/dist-installer/*.dmg
if-no-files-found: warn
# ---------------------------------------------------------------------------
# Schritt 3: Release-Assets hochladen.
# Lauft nur bei tag-push (nicht workflow_dispatch).
# ---------------------------------------------------------------------------
release:
needs: [bundle-windows, bundle-linux, bundle-macos]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download alle Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload zu Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${GITHUB_REF_NAME}"
echo "Tag: $TAG"
find artifacts -type f | head -20
# Falls Release schon existiert (manuell via gh angelegt), assets dazu
# uploaden statt neuen Release zu erstellen.
if gh release view "$TAG" >/dev/null 2>&1; then
echo "Release $TAG existiert — Assets ergaenzen"
find artifacts -type f \( -name '*.zip' -o -name '*.AppImage' -o -name '*.dmg' -o -name '*.deb' \) \
-exec gh release upload "$TAG" {} --clobber \;
else
echo "Release $TAG anlegen + Assets hochladen"
find artifacts -type f \( -name '*.zip' -o -name '*.AppImage' -o -name '*.dmg' -o -name '*.deb' \) \
-exec gh release create "$TAG" {} --title "$TAG" --prerelease --generate-notes \;
fi