Repository navigation
514 lines (454 loc) · 18.5 KB
/
Copy pathrelease.yml
File metadata and controls
514 lines (454 loc) · 18.5 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
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: ""
jobs:
build:
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
continue-on-error: ${{ matrix.experimental == true }}
strategy:
fail-fast: false
matrix:
include:
- name: windows-x86_64
runner: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: blockwork-windows-x86_64.zip
installer_arch: x64compatible
experimental: false
- name: windows-arm64
runner: windows-11-arm
target: aarch64-pc-windows-msvc
artifact_name: blockwork-windows-arm64.zip
installer_arch: arm64
qt_host: windows_arm64
qt_arch: win64_msvc2022_arm64
experimental: true
- name: macos-arm64
runner: macos-latest
target: aarch64-apple-darwin
artifact_name: blockwork-macos-arm64
qt_host: mac
qt_arch: clang_64
experimental: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout Blockstitch QML module
shell: bash
run: |
ref="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}"
if git ls-remote --exit-code --heads https://github.com/Blockworked/blockstitch.git "$ref" >/dev/null; then
git clone --depth 1 --branch "$ref" https://github.com/Blockworked/blockstitch.git ../blockstitch
else
git clone --depth 1 https://github.com/Blockworked/blockstitch.git ../blockstitch
fi
# 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 aqtinstall==3.3.0
python -m aqt install-qt ${{ matrix.qt_host }} desktop 6.10.3 ${{ matrix.qt_arch }} --outputdir "$RUNNER_TEMP/Qt"
qmake=$(find "$RUNNER_TEMP/Qt/6.10.3" -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'
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 }}
Compress-Archive -Path "dist/windows-${{ matrix.target }}/*" -DestinationPath "${{ matrix.artifact_name }}" -Force
- 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: 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.name == 'windows-x86_64'
shell: pwsh
run: ./scripts/build-msix.ps1 -Version "${{ steps.installer_version.outputs.value }}" -Target ${{ matrix.target }} -Arch x64
- name: Upload MSIX artifact
if: matrix.name == 'windows-x86_64'
uses: actions/upload-artifact@v4
with:
name: blockwork-windows-x86_64.msix
path: dist/blockwork-windows-x86_64.msix
if-no-files-found: error
retention-days: 90
linux-appimage:
name: AppImage (${{ matrix.name }})
runs-on: ${{ matrix.runner }}
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: |
ref="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}"
if git ls-remote --exit-code --heads https://github.com/Blockworked/blockstitch.git "$ref" >/dev/null; then
git clone --depth 1 --branch "$ref" https://github.com/Blockworked/blockstitch.git ../blockstitch
else
git clone --depth 1 https://github.com/Blockworked/blockstitch.git ../blockstitch
fi
# 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 aqtinstall==3.3.0
python -m aqt install-qt ${{ matrix.qt_host }} desktop 6.10.3 ${{ matrix.qt_arch }} --outputdir "$RUNNER_TEMP/Qt"
qmake=$(find "$RUNNER_TEMP/Qt/6.10.3" -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 }}
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: |
ref="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}"
if git ls-remote --exit-code --heads https://github.com/Blockworked/blockstitch.git "$ref" >/dev/null; then
git clone --depth 1 --branch "$ref" https://github.com/Blockworked/blockstitch.git ../blockstitch
else
git clone --depth 1 https://github.com/Blockworked/blockstitch.git ../blockstitch
fi
- 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]
if: always()
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: Build release notes from CHANGELOG.md
env:
TAG: ${{ steps.tag.outputs.value }}
run: |
VERSION="${TAG#v}"
awk -v ver="$VERSION" 'index($0, "## [" ver "]") == 1 {flag=1; print; next} flag && /^## \[/ {exit} flag' CHANGELOG.md > /tmp/changelog_section.md
if [ ! -s /tmp/changelog_section.md ]; then
echo "## $TAG" > /tmp/changelog_section.md
echo "" >> /tmp/changelog_section.md
echo "See commit history since the previous tag for details." >> /tmp/changelog_section.md
fi
{
cat /tmp/changelog_section.md
echo ""
echo "## Downloads"
echo ""
echo "| Platform | File |"
echo "|---|---|"
echo "| Windows x86_64 (installer) | \`blockwork-windows-x86_64-setup.exe\` |"
echo "| Windows x86_64 (portable Qt bundle) | \`blockwork-windows-x86_64.zip\` |"
echo "| Windows x86_64 (MSIX, for the Microsoft Store) | \`blockwork-windows-x86_64.msix\` |"
echo "| Windows arm64 (installer) | \`blockwork-windows-arm64-setup.exe\` |"
echo "| Windows arm64 (portable Qt bundle) | \`blockwork-windows-arm64.zip\` |"
echo "| Linux x86_64 (AppImage) | \`blockwork-linux-x86_64.AppImage\` |"
echo "| Linux x86_64 (Flatpak) | \`blockwork-linux-x86_64.flatpak\` |"
echo "| Linux arm64 (AppImage) | \`blockwork-linux-arm64.AppImage\` |"
echo "| Linux arm64 (Flatpak) | \`blockwork-linux-arm64.flatpak\` |"
echo "| macOS arm64 (app bundle, unsigned) | \`blockwork-macos-arm64.app.zip\` |"
} > RELEASE_BODY.md
cat RELEASE_BODY.md
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./release-artifacts
- name: List release artifacts
run: ls -lh ./release-artifacts/
- 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: false
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]
uses: ./.github/workflows/homebrew.yml
with:
tag: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
secrets: inherit
winget:
name: Publish to winget
runs-on: windows-latest
needs: [release]
env:
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
steps:
# Updates an existing package; the first version is submitted by hand
- name: Open winget-pkgs PR
if: env.WINGET_TOKEN != ''
uses: vedantmgoyal9/winget-releaser@main
with:
identifier: Blockworked.Blockwork
release-tag: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
installers-regex: '-setup\.exe$'
token: ${{ secrets.WINGET_TOKEN }}