@@ -309,8 +309,8 @@ jobs:
309309 Remove-Item "unigetui_bin" -Recurse -Force -ErrorAction SilentlyContinue
310310
311311 build-avalonia :
312- name : Build Avalonia (${{ matrix.platform }})
313- runs-on : macos-latest
312+ name : Build (${{ matrix.name }})
313+ runs-on : ${{ matrix.os }}
314314 needs : [preflight]
315315 environment : ${{ needs.preflight.outputs.package-env }}
316316 permissions :
@@ -322,7 +322,19 @@ jobs:
322322 strategy :
323323 fail-fast : false
324324 matrix :
325- platform : [arm64, x64]
325+ include :
326+ - os : macos-latest
327+ name : macos-arm64
328+ runtime : osx-arm64
329+ - os : macos-latest
330+ name : macos-x64
331+ runtime : osx-x64
332+ - os : ubuntu-latest
333+ name : linux-x64
334+ runtime : linux-x64
335+ - os : ubuntu-latest
336+ name : linux-arm64
337+ runtime : linux-arm64
326338
327339 steps :
328340 - name : Checkout
@@ -341,6 +353,12 @@ jobs:
341353 restore-keys : |
342354 ${{ runner.os }}-nuget-
343355
356+ - name : Set version
357+ shell : pwsh
358+ run : |
359+ $PackageVersion = '${{ needs.preflight.outputs.package-version }}'
360+ ./scripts/set-version.ps1 -Version $PackageVersion
361+
344362 - name : Restore dependencies
345363 working-directory : src
346364 run : dotnet restore UniGetUI.Avalonia/UniGetUI.Avalonia.csproj
@@ -350,15 +368,85 @@ jobs:
350368 run : |
351369 dotnet publish UniGetUI.Avalonia/UniGetUI.Avalonia.csproj \
352370 --configuration Release \
353- --runtime osx- ${{ matrix.platform }} \
371+ --runtime ${{ matrix.runtime }} \
354372 --self-contained true \
355- --output ../avalonia_bin/${{ matrix.platform }}
373+ --output ../bin/${{ matrix.name }}
374+
375+ - name : Package (macOS)
376+ if : runner.os == 'macOS'
377+ run : |
378+ mkdir -p output
379+
380+ # .tar.gz
381+ tar -czf output/UniGetUI.${{ matrix.name }}.tar.gz -C bin/${{ matrix.name }} .
382+
383+ # .dmg — create a staging folder, then convert to a compressed read-only image
384+ DMG_STAGING=$(mktemp -d)
385+ trap "rm -rf '$DMG_STAGING'" EXIT
386+ mkdir -p "$DMG_STAGING/UniGetUI"
387+ cp -R bin/${{ matrix.name }}/. "$DMG_STAGING/UniGetUI/"
388+ hdiutil create \
389+ -volname "UniGetUI" \
390+ -srcfolder "$DMG_STAGING" \
391+ -ov \
392+ -format UDZO \
393+ output/UniGetUI.${{ matrix.name }}.dmg
394+
395+ - name : Install Linux packaging tools
396+ if : runner.os == 'Linux'
397+ run : |
398+ sudo apt-get update
399+ sudo apt-get install -y rpm
400+
401+ - name : Package (Linux)
402+ if : runner.os == 'Linux'
403+ shell : pwsh
404+ run : |
405+ $Version = '${{ needs.preflight.outputs.package-version }}'
406+ $Parts = $Version -split '-', 2
407+ $BaseVersion = $Parts[0]
408+ $Prerelease = if ($Parts.Count -gt 1) { $Parts[1] } else { $null }
409+
410+ # deb: use tilde notation for pre-releases (Ubuntu 18.04+ compatible)
411+ $DebVersion = if ($Prerelease) { "${BaseVersion}~${Prerelease}" } else { $Version }
412+ # rpm: pre-release encoded in Release/Iteration field (RHEL 8+ / RPM 4.14+)
413+ $RpmVersion = $BaseVersion
414+ $RpmIteration = if ($Prerelease) { "0.${Prerelease}" } else { '1' }
415+
416+ # Map .NET RID -> package arch names
417+ $DebArch, $RpmArch = switch ('${{ matrix.runtime }}') {
418+ 'linux-arm64' { 'arm64', 'aarch64' }
419+ default { 'amd64', 'x86_64' }
420+ }
421+
422+ New-Item -ItemType Directory -Force -Path output | Out-Null
423+
424+ # .tar.gz
425+ & tar -czf "output/UniGetUI.${{ matrix.name }}.tar.gz" -C "bin/${{ matrix.name }}" .
426+ if ($LASTEXITCODE -ne 0) { exit 1 }
427+
428+ # .deb — Ubuntu 18.04+ (glibc 2.27, Debian policy 3.9.6)
429+ & ./scripts/package-linux.ps1 `
430+ -PackageType deb `
431+ -SourceDir "bin/${{ matrix.name }}" `
432+ -OutputPath "output/UniGetUI.${{ matrix.name }}.deb" `
433+ -Version $DebVersion `
434+ -Architecture $DebArch
435+
436+ # .rpm — RHEL 8+ (RPM 4.14, glibc 2.28)
437+ & ./scripts/package-linux.ps1 `
438+ -PackageType rpm `
439+ -SourceDir "bin/${{ matrix.name }}" `
440+ -OutputPath "output/UniGetUI.${{ matrix.name }}.rpm" `
441+ -Version $RpmVersion `
442+ -Iteration $RpmIteration `
443+ -Architecture $RpmArch
356444
357445 - name : Upload artifacts
358446 uses : actions/upload-artifact@v7
359447 with :
360- name : UniGetUI-Avalonia- ${{ matrix.platform }}
361- path : avalonia_bin/${{ matrix.platform }} /*
448+ name : UniGetUI-${{ matrix.name }}
449+ path : output /*
362450
363451 publish :
364452 name : Publish GitHub Release
0 commit comments