-
Notifications
You must be signed in to change notification settings - Fork 2
336 lines (299 loc) · 10.7 KB
/
Copy pathrelease.yaml
File metadata and controls
336 lines (299 loc) · 10.7 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
name: Release Electron App
on:
workflow_dispatch:
inputs:
version:
description: "Release version (e.g., 1.0.0)"
required: true
draft:
description: "Create as draft release"
type: boolean
default: true
include-testing:
description: "Include Testing View"
type: boolean
default: true
include-competition:
description: "Include Competition View"
type: boolean
default: true
include-flashing:
description: "Include Flashing View"
type: boolean
default: true
jobs:
determine-version:
name: Determine Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
is_draft: ${{ steps.get_version.outputs.is_draft }}
include_testing: ${{ steps.get_version.outputs.include_testing }}
include_competition: ${{ steps.get_version.outputs.include_competition }}
include_flashing: ${{ steps.get_version.outputs.include_flashing }}
steps:
- name: Determine version
id: get_version
run: |
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "is_draft=${{ github.event.inputs.draft }}" >> $GITHUB_OUTPUT
echo "include_testing=${{ github.event.inputs.include-testing }}" >> $GITHUB_OUTPUT
echo "include_competition=${{ github.event.inputs.include-competition }}" >> $GITHUB_OUTPUT
echo "include_flashing=${{ github.event.inputs.include-flashing }}" >> $GITHUB_OUTPUT
create-draft-release:
name: Create Draft Release
needs: determine-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create release
shell: bash
run: |
DRAFT_FLAG=""
if [ "${{ needs.determine-version.outputs.is_draft }}" = "true" ]; then
DRAFT_FLAG="--draft"
fi
gh release create v${{ needs.determine-version.outputs.version }} \
--title "Control Station v${{ needs.determine-version.outputs.version }}" \
--generate-notes \
$DRAFT_FLAG
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-frontend:
name: Build Frontend
needs: determine-version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 10.26.0
- uses: actions/setup-node@v4
with:
node-version: "24"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build with Turbo
run: |
FILTERS=""
if [ "${{ needs.determine-version.outputs.include_testing }}" = "true" ]; then
FILTERS="$FILTERS --filter=testing-view"
fi
if [ "${{ needs.determine-version.outputs.include_competition }}" = "true" ]; then
FILTERS="$FILTERS --filter=competition-view"
fi
if [ "${{ needs.determine-version.outputs.include_flashing }}" = "true" ]; then
FILTERS="$FILTERS --filter=flashing-view"
fi
pnpm turbo build $FILTERS
- uses: actions/upload-artifact@v4
if: needs.determine-version.outputs.include_testing == 'true'
with:
name: frontend-dist
path: frontend/testing-view/dist/**
retention-days: 1
- uses: actions/upload-artifact@v4
if: needs.determine-version.outputs.include_competition == 'true'
with:
name: competition-dist
path: frontend/competition-view/dist/**
retention-days: 1
- uses: actions/upload-artifact@v4
if: needs.determine-version.outputs.include_flashing == 'true'
with:
name: flashing-dist
path: frontend/flashing-view/dist/**
retention-days: 1
build-backend:
name: Build Backend - ${{ matrix.os }}
needs: determine-version
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: windows-latest
binary: backend-windows-amd64.exe
goarch: amd64
- os: ubuntu-latest
binary: backend-linux-amd64
goarch: amd64
- os: macos-latest
binary: backend-darwin-arm64
goarch: arm64
- os: macos-15-intel
binary: backend-darwin-amd64
goarch: amd64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Install Linux deps
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y gcc
- name: Build backend binary
working-directory: backend/cmd
shell: bash
run: go build -o ../../electron-app/binaries/${{ matrix.binary }} .
env:
CGO_ENABLED: 1
GOARCH: ${{ matrix.goarch }}
- uses: actions/upload-artifact@v4
with:
name: backend-${{ matrix.os }}
path: electron-app/binaries/${{ matrix.binary }}
retention-days: 1
build-blcu:
name: Build BLCU - ${{ matrix.os }}
needs: determine-version
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: windows-latest
binary: blcu-programming-windows-amd64.exe
binary-base: blcu-programming-windows-amd64
- os: ubuntu-latest
binary: blcu-programming-linux-amd64
binary-base: blcu-programming-linux-amd64
- os: macos-latest
binary: blcu-programming-darwin-arm64
binary-base: blcu-programming-darwin-arm64
- os: macos-15-intel
binary: blcu-programming-darwin-amd64
binary-base: blcu-programming-darwin-amd64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Create virtual environment
working-directory: blcu-programming
run: python -m venv .venv-build
- name: Install dependencies
working-directory: blcu-programming
shell: bash
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
.venv-build/Scripts/pip install -r requirements-build.txt
else
.venv-build/bin/pip install -r requirements-build.txt
fi
- name: Build with PyInstaller
working-directory: blcu-programming
shell: bash
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
PYTHON=".venv-build/Scripts/python"
else
PYTHON=".venv-build/bin/python"
fi
if [ "${{ runner.os }}" = "Windows" ]; then
PATH_SEP=";"
else
PATH_SEP=":"
fi
"$PYTHON" -m PyInstaller \
--clean \
--noconfirm \
--onefile \
--name "${{ matrix.binary-base }}" \
--distpath "../electron-app/binaries" \
--hidden-import uvicorn.loops.auto \
--hidden-import uvicorn.protocols.http.auto \
--hidden-import uvicorn.protocols.websockets.auto \
--hidden-import uvicorn.lifespan.on \
--hidden-import multipart \
--hidden-import multipart.multiparser \
--paths "." \
--add-data "BLCU-config.json${PATH_SEP}." \
api/main.py
- uses: actions/upload-artifact@v4
with:
name: blcu-${{ matrix.os }}
path: electron-app/binaries/${{ matrix.binary }}
retention-days: 1
package-and-upload:
name: Package & Upload - ${{ matrix.os }}
needs: [determine-version, create-draft-release, build-frontend, build-backend, build-blcu]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: windows-latest
binary: backend-windows-amd64.exe
blcu-binary: blcu-programming-windows-amd64.exe
- os: ubuntu-latest
binary: backend-linux-amd64
blcu-binary: blcu-programming-linux-amd64
- os: macos-latest
binary: backend-darwin-arm64
blcu-binary: blcu-programming-darwin-arm64
- os: macos-15-intel
binary: backend-darwin-amd64
blcu-binary: blcu-programming-darwin-amd64
steps:
- uses: actions/checkout@v4
- name: Download backend binary
uses: actions/download-artifact@v4
with:
name: backend-${{ matrix.os }}
path: electron-app/binaries
- name: Download BLCU binary
uses: actions/download-artifact@v4
with:
name: blcu-${{ matrix.os }}
path: electron-app/binaries
- name: Set executable permissions (Unix)
if: runner.os != 'Windows'
run: chmod +x electron-app/binaries/*
- name: Download frontend dist
if: needs.determine-version.outputs.include_testing == 'true'
uses: actions/download-artifact@v4
with:
name: frontend-dist
path: electron-app/renderer/testing-view
- name: Download competition-view dist
if: needs.determine-version.outputs.include_competition == 'true'
uses: actions/download-artifact@v4
with:
name: competition-dist
path: electron-app/renderer/competition-view
- name: Download flashing-view dist
if: needs.determine-version.outputs.include_flashing == 'true'
uses: actions/download-artifact@v4
with:
name: flashing-dist
path: electron-app/renderer/flashing-view
- uses: pnpm/action-setup@v4
with:
version: 10.26.0
- uses: actions/setup-node@v4
with:
node-version: "24"
- name: Update version in package.json
working-directory: electron-app
shell: bash
run: pnpm version ${{ needs.determine-version.outputs.version }} --no-git-tag-version
- name: Install Electron dependencies
working-directory: electron-app
run: pnpm install
- name: Build Electron distribution
working-directory: electron-app
run: pnpm run dist
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CSC_IDENTITY_AUTO_DISCOVERY: false
ELECTRON_BUILDER_PUBLISH: never
- name: Upload to GitHub Release
shell: bash
run: |
find electron-app/dist -maxdepth 1 -type f \
\( -name "*.exe" -o -name "*.AppImage" -o -name "*.deb" \
-o -name "*.rpm" -o -name "*.dmg" -o -name "*.zip" -o -name "*.yml" -o -name "*.blockmap" \) \
| xargs gh release upload v${{ needs.determine-version.outputs.version }} --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}