Repository navigation
567 lines (502 loc) · 20.7 KB
/
Copy pathrelease.yml
File metadata and controls
567 lines (502 loc) · 20.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
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
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
name: Release
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
tag:
description: "Release tag (e.g. 0.3.1)"
required: true
type: string
release_name:
description: "Release title (leave blank to use tag as title)"
required: false
type: string
default: ""
flight:
description: "Microsoft Store package flight (name or ID). Missing names are created through the API; builds go only to that flight"
required: false
type: string
default: ""
flight_group_ids:
description: "Comma-separated tester group IDs for a newly created Store flight (existing flights keep their groups)"
required: false
type: string
default: ""
env:
# The Qt every job installs; bump it here and in the other workflows.
QT_VERSION: 6.12.0
jobs:
plan:
name: Plan builds
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.value }}
steps:
# A flight run only needs the MSIX packages, which the Windows builds make
- name: Pick platforms
id: matrix
env:
FLIGHT: ${{ inputs.flight }}
run: |
matrix='[
{"name": "windows-x86_64", "runner": "windows-latest", "target": "x86_64-pc-windows-msvc",
"artifact_name": "blockwork-windows-x86_64.zip", "installer_arch": "x64compatible", "msix_arch": "x64",
"qt_host": "windows", "qt_arch": "win64_msvc2022_64"},
{"name": "windows-arm64", "runner": "windows-11-arm", "target": "aarch64-pc-windows-msvc",
"artifact_name": "blockwork-windows-arm64.zip", "installer_arch": "arm64", "msix_arch": "arm64",
"qt_host": "windows_arm64", "qt_arch": "win64_msvc2022_arm64"},
{"name": "macos-arm64", "runner": "macos-latest", "target": "aarch64-apple-darwin",
"artifact_name": "blockwork-macos-arm64", "qt_host": "mac", "qt_arch": "clang_64"},
{"name": "macos-x86_64", "runner": "macos-15-intel", "target": "x86_64-apple-darwin",
"artifact_name": "blockwork-macos-x86_64", "qt_host": "mac", "qt_arch": "clang_64"}
]'
if [ -n "$FLIGHT" ]; then
matrix=$(jq -c 'map(select(.msix_arch))' <<< "$matrix")
fi
echo "value={\"include\": $(jq -c . <<< "$matrix")}" >> "$GITHUB_OUTPUT"
build:
name: Build (${{ matrix.name }})
needs: [plan]
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.plan.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout Blockstitch QML module
shell: bash
run: |
scripts/fetch-blockstitch.sh ../blockstitch
# Official Qt builds where CXX-Qt's Qt download is missing or broken.
- name: Set up Python
if: matrix.qt_arch
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install Qt
if: matrix.qt_arch
shell: bash
run: |
python -m pip install py7zr==1.1.3 "aqtinstall @ git+https://github.com/miurahr/aqtinstall.git@076e1659807d0b362a3ed684d54c2e9c775eb9c7"
# A Qt mirror sometimes serves a broken archive, so try a few times.
for attempt in 1 2 3; do
rm -rf "$RUNNER_TEMP/Qt"
python -m aqt install-qt ${{ matrix.qt_host }} desktop ${{ env.QT_VERSION }} ${{ matrix.qt_arch }} --outputdir "$RUNNER_TEMP/Qt" && break
if [ "$attempt" = 3 ]; then exit 1; fi
echo "::warning::Qt install failed (attempt $attempt), retrying"
sleep 15
done
qmake=$(find "$RUNNER_TEMP/Qt/${{ env.QT_VERSION }}" -maxdepth 3 -path '*/bin/*' \( -name qmake -o -name qmake.exe \) | head -n 1)
test -n "$qmake"
if [[ "$RUNNER_OS" == Windows ]]; then qmake=$(cygpath -w "$qmake"); fi
echo "QMAKE=$qmake" >> "$GITHUB_ENV"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build (release, Windows)
if: runner.os == 'Windows'
env:
# Allow transient registry DNS failures to recover before failing the build.
CARGO_NET_RETRY: '10'
run: cargo build --release --target ${{ matrix.target }} --workspace --exclude blockwork-linux-bridge
- name: Stage Qt application (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
./scripts/deploy-qt-windows.ps1 -Target ${{ matrix.target }}
./scripts/package-portable-windows.ps1 -Target ${{ matrix.target }} -Output "${{ matrix.artifact_name }}"
- name: Upload artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}
if-no-files-found: error
retention-days: 90
- name: Build macOS app bundle
if: runner.os == 'macOS'
env:
MACOSX_DEPLOYMENT_TARGET: '13.0'
# Newer Xcode clang lists __yield as a builtin but needs arm_acle.h to declare it (Qt's qyieldcpu.h).
CXXFLAGS_aarch64_apple_darwin: -include arm_acle.h
run: ./scripts/build-macos-bundle.sh ${{ matrix.target }}
- name: Verify packaged executable starts
if: runner.os == 'macOS'
run: dist/Blockwork.app/Contents/MacOS/Blockwork --help
- name: Run application QML tests
if: runner.os == 'macOS'
run: |
export PATH="$(dirname "$QMAKE"):$PATH"
python3 blockwork-qt/tests/run.py ../blockstitch
- name: Zip macOS app bundle
if: runner.os == 'macOS'
run: ditto -c -k --sequesterRsrc --keepParent dist/Blockwork.app ${{ matrix.artifact_name }}.app.zip
- name: Upload macOS app bundle
if: runner.os == 'macOS'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}.app.zip
path: ${{ matrix.artifact_name }}.app.zip
if-no-files-found: error
retention-days: 90
- name: Locate or install Inno Setup
if: runner.os == 'Windows'
shell: pwsh
run: |
$iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
if (-not (Test-Path $iscc)) {
choco install innosetup -y
}
- name: Determine installer version
if: runner.os == 'Windows'
id: installer_version
shell: pwsh
run: |
$tag = "${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}"
$version = $tag -replace '^v', ''
echo "value=$version" >> $env:GITHUB_OUTPUT
- name: Build installer (Inno Setup)
if: runner.os == 'Windows'
shell: pwsh
run: |
$iscc = "C:\Program Files (x86)\Inno Setup 6\ISCC.exe"
& $iscc "/DMyAppVersion=${{ steps.installer_version.outputs.value }}" "/DTargetTriple=${{ matrix.target }}" "/DInstallerArch=${{ matrix.installer_arch }}" "/DOutputBaseFilename=blockwork-${{ matrix.name }}-setup" installer\blockwork.iss
- name: Upload installer artifact
if: runner.os == 'Windows'
uses: actions/upload-artifact@v4
with:
name: blockwork-${{ matrix.name }}-setup.exe
path: dist/blockwork-${{ matrix.name }}-setup.exe
if-no-files-found: error
retention-days: 90
- name: Build MSIX (Microsoft Store)
if: matrix.msix_arch
shell: pwsh
run: ./scripts/build-msix.ps1 -Version "${{ steps.installer_version.outputs.value }}" -Target ${{ matrix.target }} -Arch ${{ matrix.msix_arch }}
- name: Upload MSIX artifact
if: matrix.msix_arch
uses: actions/upload-artifact@v4
with:
name: blockwork-${{ matrix.name }}.msix
path: dist/blockwork-${{ matrix.name }}.msix
if-no-files-found: error
retention-days: 90
linux-appimage:
name: AppImage (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
if: ${{ !inputs.flight }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
runner: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: blockwork-linux-x86_64
linux_arch: x86_64
qt_host: linux
qt_arch: linux_gcc_64
- name: linux-arm64
runner: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
artifact_name: blockwork-linux-arm64
linux_arch: aarch64
qt_host: linux_arm64
qt_arch: linux_gcc_arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout Blockstitch QML module
shell: bash
run: |
scripts/fetch-blockstitch.sh ../blockstitch
# Official Qt builds where CXX-Qt's Qt download is missing or broken.
- name: Set up Python
if: matrix.qt_arch
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install Qt
if: matrix.qt_arch
shell: bash
run: |
python -m pip install py7zr==1.1.3 "aqtinstall @ git+https://github.com/miurahr/aqtinstall.git@076e1659807d0b362a3ed684d54c2e9c775eb9c7"
# A Qt mirror sometimes serves a broken archive, so try a few times.
for attempt in 1 2 3; do
rm -rf "$RUNNER_TEMP/Qt"
python -m aqt install-qt ${{ matrix.qt_host }} desktop ${{ env.QT_VERSION }} ${{ matrix.qt_arch }} --outputdir "$RUNNER_TEMP/Qt" && break
if [ "$attempt" = 3 ]; then exit 1; fi
echo "::warning::Qt install failed (attempt $attempt), retrying"
sleep 15
done
qmake=$(find "$RUNNER_TEMP/Qt/${{ env.QT_VERSION }}" -maxdepth 3 -path '*/bin/*' \( -name qmake -o -name qmake.exe \) | head -n 1)
test -n "$qmake"
if [[ "$RUNNER_OS" == Windows ]]; then qmake=$(cygpath -w "$qmake"); fi
echo "QMAKE=$qmake" >> "$GITHUB_ENV"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust build artifacts
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install Linux system dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
pkg-config \
build-essential \
curl \
wget \
file \
libssl-dev \
libxdo-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
libdbus-1-dev \
libxkbcommon-dev \
libxkbcommon-x11-0 \
libx11-dev \
libx11-xcb-dev \
libxtst-dev \
libwayland-dev \
wayland-protocols \
libclang-dev \
lld \
libxcb-cursor0 \
libxcb-icccm4 \
libxcb-image0 \
libxcb-keysyms1 \
libxcb-render-util0 \
libxcb-shape0 \
libxcb-util1
- name: Build (release)
run: cargo build --release --target ${{ matrix.target }} --workspace --exclude blockwork-linux-bridge
- name: Build AppImage
run: |
export APPIMAGE_EXTRACT_AND_RUN=1
# linuxdeploy-plugin-qt only bundles xcb unless told otherwise.
export EXTRA_PLATFORM_PLUGINS=libqwayland.so
wget -q -O linuxdeploy.AppImage "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${{ matrix.linux_arch }}.AppImage"
wget -q -O linuxdeploy-plugin-appimage.AppImage "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-${{ matrix.linux_arch }}.AppImage"
wget -q -O linuxdeploy-plugin-qt.AppImage "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-${{ matrix.linux_arch }}.AppImage"
chmod +x linuxdeploy.AppImage linuxdeploy-plugin-appimage.AppImage linuxdeploy-plugin-qt.AppImage
export LD_LIBRARY_PATH="$($QMAKE -query QT_INSTALL_LIBS):${LD_LIBRARY_PATH:-}"
export QML_SOURCES_PATHS="$PWD/blockwork-qt/qml:$PWD/../blockstitch/qml"
RELEASE_DIR="target/${{ matrix.target }}/release"
./linuxdeploy.AppImage \
--appdir AppDir \
--executable "$RELEASE_DIR/blockwork" \
--executable "$RELEASE_DIR/blockwork-daemon" \
--desktop-file res/blockwork.desktop \
--icon-file res/icons/blockwork.png \
--plugin qt \
--output appimage
mv Blockwork*.AppImage ${{ matrix.artifact_name }}.AppImage
- name: Upload AppImage artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}.AppImage
path: ${{ matrix.artifact_name }}.AppImage
if-no-files-found: error
retention-days: 90
linux-flatpak:
name: Flatpak (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
if: ${{ !inputs.flight }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x86_64
runner: ubuntu-latest
artifact_name: blockwork-linux-x86_64
- name: linux-arm64
runner: ubuntu-24.04-arm
artifact_name: blockwork-linux-arm64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Checkout Blockstitch QML module
shell: bash
run: |
scripts/fetch-blockstitch.sh ../blockstitch
- name: Install Flatpak tooling
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends flatpak flatpak-builder elfutils
flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install --user --noninteractive flathub \
org.kde.Platform//6.10 org.kde.Sdk//6.10 \
org.freedesktop.Sdk.Extension.rust-stable//25.08 \
org.flatpak.Builder
- name: Generate offline Cargo sources
run: |
flatpak run --filesystem="$PWD" --command=flatpak-cargo-generator \
org.flatpak.Builder -o packaging/flatpak/cargo-sources.json Cargo.lock
- name: Build Flatpak
# Offline sandbox build, no host cargo build needed.
run: |
manifest=packaging/flatpak/com.blockworked.Blockwork
awk '
/# BEGIN app-source/ {
print
print " - type: dir"
print " path: ../.."
print " skip: [target, .git, .flatpak-builder, flatpak-build, flatpak-repo, packaging/flatpak]"
skip = "app"
next
}
/# END app-source/ { skip = ""; print; next }
/# BEGIN blockstitch-source/ {
print
print " - type: dir"
print " path: ../../../blockstitch"
print " dest: .flatpak-blockstitch"
print " skip: [target, .git, node_modules, dist]"
skip = "blockstitch"
next
}
/# END blockstitch-source/ { skip = ""; print; next }
!skip
' "$manifest.yml" > "$manifest.local.yml"
flatpak-builder --force-clean --user --default-branch=stable --repo=flatpak-repo flatpak-build "$manifest.local.yml"
flatpak build-bundle flatpak-repo ${{ matrix.artifact_name }}.flatpak com.blockworked.Blockwork stable
- name: Upload Flatpak artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}.flatpak
path: ${{ matrix.artifact_name }}.flatpak
if-no-files-found: error
retention-days: 90
release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [build, linux-appimage, linux-flatpak]
outputs:
has_macos: ${{ steps.notes.outputs.has_macos }}
# A flight build goes to the Store flight only, so no GitHub release (and no Chocolatey, Homebrew or winget)
if: ${{ success() && !inputs.flight }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine release tag
id: tag
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "value=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "value=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Determine release name
id: release_name
run: |
NAME="${{ inputs.release_name }}"
if [ -z "$NAME" ]; then
NAME="${{ steps.tag.outputs.value }}"
fi
echo "value=$NAME" >> "$GITHUB_OUTPUT"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./release-artifacts
- name: Validate artifacts and build release notes
id: notes
env:
TAG: ${{ steps.tag.outputs.value }}
run: |
python3 .github/prepare-release.py --tag "$TAG" --artifacts release-artifacts --output RELEASE_BODY.md
if [ -s release-artifacts/blockwork-macos-arm64.app.zip ]; then
echo "has_macos=true" >> "$GITHUB_OUTPUT"
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.tag.outputs.value }}
name: ${{ steps.release_name.outputs.value }}
draft: false
prerelease: false
fail_on_unmatched_files: true
files: ./release-artifacts/*
body_path: RELEASE_BODY.md
chocolatey:
name: Chocolatey
needs: [release]
uses: ./.github/workflows/chocolatey.yml
with:
tag: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
secrets: inherit
homebrew:
name: Homebrew
needs: [release]
if: ${{ needs.release.outputs.has_macos == 'true' }}
uses: ./.github/workflows/homebrew.yml
with:
tag: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
secrets: inherit
winget:
name: Publish to winget
needs: [release]
uses: ./.github/workflows/winget.yml
with:
tag: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
secrets: inherit
msstore:
name: Submit to Microsoft Store
runs-on: windows-latest
needs: [build, release]
if: ${{ always() && needs.build.result == 'success' && (needs.release.result == 'success' || inputs.flight) }}
env:
MSSTORE_FLIGHT: ${{ inputs.flight }}
MSSTORE_FLIGHT_GROUP_IDS: ${{ inputs.flight_group_ids }}
MSSTORE_TENANT_ID: ${{ secrets.MSSTORE_TENANT_ID }}
MSSTORE_CLIENT_ID: ${{ secrets.MSSTORE_CLIENT_ID }}
MSSTORE_CLIENT_SECRET: ${{ secrets.MSSTORE_CLIENT_SECRET }}
MSSTORE_APP_ID: ${{ vars.MSSTORE_APP_ID || secrets.MSSTORE_APP_ID }}
steps:
# Skipped until the Partner Center credentials are set, like winget
- name: Check Store credentials
id: creds
shell: pwsh
run: |
$missing = @("MSSTORE_TENANT_ID", "MSSTORE_CLIENT_ID", "MSSTORE_CLIENT_SECRET", "MSSTORE_APP_ID") |
Where-Object { -not [Environment]::GetEnvironmentVariable($_) }
if ($missing) {
Write-Host "Skipping Store submission, not set: $($missing -join ', ')"
echo "ready=false" >> $env:GITHUB_OUTPUT
} else {
echo "ready=true" >> $env:GITHUB_OUTPUT
}
- name: Checkout
if: steps.creds.outputs.ready == 'true'
uses: actions/checkout@v4
- name: Download MSIX packages
if: steps.creds.outputs.ready == 'true'
uses: actions/download-artifact@v4
with:
pattern: blockwork-windows-*.msix
merge-multiple: true
path: dist
# The Store signs the package and runs certification after this
- name: Submit to Partner Center
if: steps.creds.outputs.ready == 'true'
shell: pwsh
run: |
$packages = @(Get-ChildItem dist/*.msix | ForEach-Object FullName)
if (-not ($packages -match 'x86_64')) { throw "The x64 MSIX is missing" }
if (-not ($packages -match 'arm64')) { throw "The arm64 MSIX is missing" }
./scripts/submit-msstore.ps1 -Msix $packages -Flight "$env:MSSTORE_FLIGHT" -FlightGroupIds @($env:MSSTORE_FLIGHT_GROUP_IDS)