-
Notifications
You must be signed in to change notification settings - Fork 0
342 lines (306 loc) · 12.7 KB
/
Copy pathrelease_packages.yml
File metadata and controls
342 lines (306 loc) · 12.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
name: Release Packages
on:
release:
types: [published]
workflow_dispatch:
inputs:
release_tag:
description: "Tag name to publish (for example: v0.4.1 or preview)"
required: true
type: string
release_name:
description: Optional release title override
required: false
default: ""
type: string
prerelease:
description: Mark the release as prerelease
required: false
default: false
type: boolean
permissions:
contents: write
concurrency:
group: release-packages-${{ github.ref }}
cancel-in-progress: false
jobs:
linux-packages:
name: Linux (${{ matrix.arch }})
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
include:
- arch: x64
emulated: false
- arch: arm64
emulated: true
steps:
- name: Checkout
uses: actions/checkout@v4
# Persist compiler output so emulated arm64 rebuilds (failure retries)
# do not recompile the whole tree under QEMU.
- name: Cache ccache
uses: actions/cache@v4
with:
path: .ccache
key: ccache-linux-${{ matrix.arch }}-${{ github.sha }}
restore-keys: |
ccache-linux-${{ matrix.arch }}-
- name: Set up QEMU for arm64 emulation
if: matrix.emulated
uses: docker/setup-qemu-action@v3
- name: Install build dependencies
if: ${{ !matrix.emulated }}
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential cmake ninja-build pkg-config curl ccache \
libasound2-dev libjack-jackd2-dev libfreetype6-dev libfontconfig1-dev \
libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxinerama-dev \
libxrandr-dev libxrender-dev libwebkit2gtk-4.1-dev libgtk-3-dev \
libglu1-mesa-dev mesa-common-dev libcurl4-openssl-dev \
dpkg-dev fakeroot flatpak flatpak-builder
# Public ubuntu-24.04-arm64 runners are frequently starved for 10h+,
# so arm64 packages are built on the x64 runner inside an emulated
# arm64v8/ubuntu:24.04 container (docker/setup-qemu-action registers
# binfmt_misc, docker run --platform linux/arm64 executes native arm64
# binaries under QEMU user-mode emulation).
- name: Build .deb + AppImage
if: ${{ !matrix.emulated }}
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
run: bash ./tools/package_linux.sh
- name: Build .deb + AppImage (arm64, QEMU-emulated)
if: matrix.emulated
run: |
docker run --rm --platform linux/arm64 \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
-e CCACHE_DIR=/workspace/.ccache \
-e AUTOMIX_QEMU_EMULATED=1 \
arm64v8/ubuntu:24.04 \
bash -c 'set -euo pipefail; \
apt-get update && apt-get install -y --no-install-recommends \
build-essential cmake ninja-build pkg-config curl git ca-certificates \
ccache unzip file xz-utils \
libasound2-dev libjack-jackd2-dev libfreetype6-dev libfontconfig1-dev \
libx11-dev libxcomposite-dev libxcursor-dev libxext-dev libxinerama-dev \
libxrandr-dev libxrender-dev libwebkit2gtk-4.1-dev libgtk-3-dev \
libglu1-mesa-dev mesa-common-dev libcurl4-openssl-dev \
dpkg-dev fakeroot; \
bash ./tools/package_linux.sh'
sudo chown -R "$(id -u):$(id -g)" dist
if [[ -d .ccache ]]; then sudo chown -R "$(id -u):$(id -g)" .ccache; fi
- name: Verify Flatpak prefetch wiring
run: |
grep -q "FETCHCONTENT_FULLY_DISCONNECTED=ON" packaging/flatpak/io.automixmaster.AutoMixMaster.yml
grep -q "FETCHCONTENT_SOURCE_DIR_NLOHMANN_JSON" packaging/flatpak/io.automixmaster.AutoMixMaster.yml
grep -q "type: git" packaging/flatpak/io.automixmaster.AutoMixMaster.yml
# Flatpak sandbox builds can fail if CMake FetchContent tries live GitHub clone.
# Keep manifest prefetch sources + FETCHCONTENT_SOURCE_DIR_* overrides in sync.
- name: Build Flatpak bundle
if: ${{ !matrix.emulated }}
run: bash ./tools/build_flatpak.sh
- name: Build Flatpak bundle (arm64, QEMU-emulated)
if: matrix.emulated
run: |
docker run --rm --platform linux/arm64 \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
-e AUTOMIX_FLATPAK_DISABLE_SANDBOX=1 \
arm64v8/ubuntu:24.04 \
bash -c 'set -euo pipefail; \
apt-get update && apt-get install -y --no-install-recommends \
flatpak flatpak-builder git ca-certificates; \
bash ./tools/build_flatpak.sh'
sudo chown -R "$(id -u):$(id -g)" dist
- name: Collect Linux release assets
run: |
mkdir -p dist/release/linux
cp dist/linux/*.deb dist/release/linux/
cp dist/linux/*.AppImage dist/release/linux/
cp dist/linux/*.sha256 dist/release/linux/ || true
cp dist/flatpak/AutoMixMaster.flatpak "dist/release/linux/AutoMixMaster-linux-${{ matrix.arch }}.flatpak"
(cd dist/release/linux && sha256sum * > "SHA256SUMS-linux-${{ matrix.arch }}.txt")
- name: Upload Linux assets
uses: actions/upload-artifact@v4
with:
name: release-linux-${{ matrix.arch }}
path: dist/release/linux/*
if-no-files-found: error
windows-package:
name: Windows (${{ matrix.arch }})
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- arch: x64
vs_platform: x64
- arch: arm64
vs_platform: ARM64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure
shell: pwsh
run: |
# Auto-detect the installed Visual Studio generator
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vsWhere) {
$vsVersion = & $vsWhere -latest -property catalog_productLineVersion
Write-Host "Detected Visual Studio $vsVersion"
}
cmake -S . -B build_windows_${{ matrix.arch }} -A ${{ matrix.vs_platform }} -DBUILD_TESTING=OFF -DBUILD_TOOLS=OFF
- name: Build
run: cmake --build build_windows_${{ matrix.arch }} --config Release --target AutoMixMasterApp --parallel 3
- name: Package Windows zip
shell: pwsh
run: |
$releaseRoot = "dist/release/windows"
$packageDir = "$releaseRoot/AutoMixMaster-windows-${{ matrix.arch }}"
New-Item -ItemType Directory -Force -Path $packageDir | Out-Null
$exeCandidates = @(
"build_windows_${{ matrix.arch }}/AutoMixMasterApp_artefacts/Release/AutoMixMaster.exe",
"build_windows_${{ matrix.arch }}/AutoMixMasterApp_artefacts/Release/Standalone/AutoMixMaster.exe",
"build_windows_${{ matrix.arch }}/AutoMixMasterApp_artefacts/AutoMixMaster.exe"
)
$exePath = $exeCandidates | Where-Object { Test-Path $_ } | Select-Object -First 1
if (-not $exePath) { throw "AutoMixMaster.exe not found in build outputs!" }
Copy-Item $exePath "$packageDir/AutoMixMaster.exe" -Force
Copy-Item "assets" "$packageDir/assets" -Recurse -Force
$zipName = "AutoMixMaster-windows-${{ matrix.arch }}.zip"
$zipPath = "$releaseRoot/$zipName"
if (Test-Path $zipPath) { Remove-Item $zipPath -Force }
Compress-Archive -Path "$packageDir/*" -DestinationPath $zipPath -CompressionLevel Optimal
$hash = (Get-FileHash -Path $zipPath -Algorithm SHA256).Hash.ToLower()
"$hash $zipName" | Set-Content "$zipPath.sha256"
- name: Upload Windows assets
uses: actions/upload-artifact@v4
with:
name: release-windows-${{ matrix.arch }}
path: |
dist/release/windows/AutoMixMaster-windows-${{ matrix.arch }}.zip
dist/release/windows/AutoMixMaster-windows-${{ matrix.arch }}.zip.sha256
if-no-files-found: error
macos-package:
name: macOS (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- arch: x64
runner: macos-15
cmake_arch: x86_64
- arch: arm64
runner: macos-15
cmake_arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure
run: >
cmake -S . -B build_macos_${{ matrix.arch }}
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.cmake_arch }}
-DBUILD_TESTING=OFF
-DBUILD_TOOLS=OFF
- name: Build
run: cmake --build build_macos_${{ matrix.arch }} --target AutoMixMasterApp --parallel 3
- name: Package macOS zip
run: |
mkdir -p dist/release/macos
APP_BUNDLE="$(find build_macos_${{ matrix.arch }} -maxdepth 6 -type d -name 'AutoMixMaster.app' | head -n 1)"
if [[ -z "$APP_BUNDLE" ]]; then
echo "AutoMixMaster.app not found" >&2
exit 1
fi
mkdir -p "$APP_BUNDLE/Contents/MacOS"
cp -R assets "$APP_BUNDLE/Contents/MacOS/assets"
ZIP_PATH="dist/release/macos/AutoMixMaster-macos-${{ matrix.arch }}.zip"
ditto -c -k --sequesterRsrc --keepParent "$APP_BUNDLE" "$ZIP_PATH"
shasum -a 256 "$ZIP_PATH" > "${ZIP_PATH}.sha256"
- name: Upload macOS assets
uses: actions/upload-artifact@v4
with:
name: release-macos-${{ matrix.arch }}
path: |
dist/release/macos/AutoMixMaster-macos-${{ matrix.arch }}.zip
dist/release/macos/AutoMixMaster-macos-${{ matrix.arch }}.zip.sha256
if-no-files-found: error
publish-release-assets:
name: Publish assets to GitHub Release
if: ${{ (github.event_name == 'release' || github.event_name == 'workflow_dispatch') && always() }}
runs-on: ubuntu-24.04
needs:
- linux-packages
- windows-package
- macos-package
steps:
- name: Download all packaged artifacts
uses: actions/download-artifact@v4
with:
pattern: release-*
merge-multiple: true
path: release-assets
- name: Resolve release metadata
id: release-meta
shell: bash
run: |
set -euo pipefail
if [[ "${GITHUB_EVENT_NAME}" == "release" ]]; then
tag="${{ github.event.release.tag_name }}"
name="${{ github.event.release.name }}"
prerelease="${{ github.event.release.prerelease }}"
else
tag="${{ inputs.release_tag }}"
name="${{ inputs.release_name }}"
prerelease="${{ inputs.prerelease }}"
fi
if [[ -z "$tag" ]]; then
echo "Release tag is required." >&2
exit 1
fi
if [[ -z "$name" ]]; then
name="AutoMixMaster Release ${tag}"
fi
{
echo "tag=$tag"
echo "name=$name"
echo "prerelease=$prerelease"
} >> "$GITHUB_OUTPUT"
- name: Validate release tag
shell: bash
run: |
set -euo pipefail
tag="${{ steps.release-meta.outputs.tag }}"
# GitHub tags must be valid git refs; the API rejects names with
# spaces or characters outside [0-9A-Za-z._/-] ("tag_name is not a
# valid tag"), e.g. "0.4.3 AKA (v1.1)".
if [[ -z "$tag" || "$tag" =~ [^0-9A-Za-z._/-] || "$tag" == *".."* || "$tag" == .* || "$tag" == *. || "$tag" == -* ]]; then
echo "Release tag '$tag' is not a valid GitHub tag name." >&2
echo "Tags may only contain letters, digits, '.', '_', '-' and '/', must not" >&2
echo "contain spaces or '..', and must not start with '-' or end with '.'. Example: v0.4.3" >&2
exit 1
fi
- name: Ensure release assets exist
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
assets=(release-assets/*)
if (( ${#assets[@]} == 0 )); then
echo "No release artifacts were found in release-assets/." >&2
exit 1
fi
- name: Publish assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.release-meta.outputs.tag }}
name: ${{ steps.release-meta.outputs.name }}
prerelease: ${{ steps.release-meta.outputs.prerelease }}
files: release-assets/*
fail_on_unmatched_files: true
overwrite_files: true