Skip to content

Merge pull request #16 from tsuchim/codex/release-0.6.3-prep #68

Merge pull request #16 from tsuchim/codex/release-0.6.3-prep

Merge pull request #16 from tsuchim/codex/release-0.6.3-prep #68

# Build release artifacts from signed tags.
# Signing will be added later via SignPath Foundation.
name: Build Release Artifacts
on:
push:
tags:
- 'v*'
pull_request:
branches:
- main
workflow_dispatch:
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
env:
VERSION: ''
DIST_DIR: dist
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Determine version
run: |
if ($env:GITHUB_REF -match '^refs/tags/(v.+)$') {
$ver = $Matches[1]
} else {
$ver = 'dev'
}
"VERSION=$ver" | Out-File $env:GITHUB_ENV -Append
Write-Host "VERSION=$ver"
- name: Create output directory
run: New-Item -ItemType Directory -Force -Path $env:DIST_DIR | Out-Null
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json
- name: Restore
run: dotnet restore WindowThumbWall.csproj
- name: Install WiX
run: |
dotnet tool install --global wix --version 5.0.2
wix --version
- name: Add WiX UI extension
run: |
$wixVer = (wix --version) -replace '\+.*',''
wix extension add -g "WixToolset.UI.wixext/$wixVer"
- name: Build architectures
run: |
$architectures = @("x64", "arm64")
foreach ($arch in $architectures) {
$runtime = "win-$arch"
Write-Host ">> Building for $runtime..." -ForegroundColor Cyan
# ── Publish ──────────────────────────────────────────────
dotnet publish WindowThumbWall.csproj `
-c Release -r $runtime --self-contained `
-p:PublishSingleFile=false `
-o "publish-$arch"
# ── ZIP artifact ─────────────────────────────────────────
Get-ChildItem "publish-$arch" -Filter *.pdb -Recurse | Remove-Item -Force
Compress-Archive -Path "publish-$arch\*" -DestinationPath "$env:DIST_DIR\WindowThumbWall-$env:VERSION-win-$arch.zip" -CompressionLevel Optimal
# ── MSI artifact (WiX v5) ────────────────────────────────
# We need to publish again for MSI because it might need different settings or just a clean dir
dotnet publish WindowThumbWall.csproj `
-c Release -r $runtime --self-contained `
-p:PublishSingleFile=false `
-o "publish-msi-$arch"
wix build packaging\WindowThumbWall.wxs `
-arch $arch `
-ext WixToolset.UI.wixext `
-d PublishDir="publish-msi-$arch" `
-o "$env:DIST_DIR\WindowThumbWall-$env:VERSION-win-$arch.msi"
# ── MSIX artifact ───────────────────────────────────────
dotnet publish WindowThumbWall.csproj `
-c Release -r $runtime --self-contained `
-p:PublishSingleFile=false `
-o "publish-msix-$arch"
Copy-Item packaging\AppxManifest.xml "publish-msix-$arch" -Force
Copy-Item packaging\Assets "publish-msix-$arch\Assets" -Recurse -Force
# Patch MSIX manifest version and architecture
$plainVersion = $env:VERSION -replace '^v', ''
$manifestPath = "publish-msix-$arch\AppxManifest.xml"
[xml]$xml = Get-Content $manifestPath
if ($plainVersion -match '^\d+\.\d+\.\d+$') {
$versionParts = $plainVersion.Split('.')
$packageVersion = "$($versionParts[0]).$($versionParts[1]).$($versionParts[2]).0"
$xml.Package.Identity.Version = $packageVersion
Write-Host "Patched MSIX manifest version to $packageVersion"
}
$xml.Package.Identity.ProcessorArchitecture = $arch
$xml.Save((Resolve-Path $manifestPath))
Write-Host "Patched MSIX manifest architecture to $arch"
$makeappx = Get-ChildItem "C:\Program Files (x86)\Windows Kits\10\bin\*\x64\makeappx.exe" -ErrorAction SilentlyContinue |
Sort-Object FullName -Descending | Select-Object -First 1 -ExpandProperty FullName
if (-not $makeappx) {
Write-Error "makeappx.exe not found. Ensure Windows SDK is installed."
exit 1
}
& $makeappx pack /d "publish-msix-$arch" /p "$env:DIST_DIR\WindowThumbWall-$env:VERSION-win-$arch.msix" /o
}
# ── Generate Metadata ─────────────────────────────────────
- name: Generate release metadata
run: |
.\packaging\generate-release-metadata.ps1 -Version "$env:VERSION" -OutputDir "$env:DIST_DIR"
# ── Upload artifacts ───────────────────────────────────────
# These unsigned artifacts will be signed via SignPath in a future step.
- name: Upload unsigned artifacts
uses: actions/upload-artifact@v4
with:
name: unsigned-artifacts
path: |
${{ env.DIST_DIR }}/WindowThumbWall-${{ env.VERSION }}-win-*.zip
${{ env.DIST_DIR }}/WindowThumbWall-${{ env.VERSION }}-win-*.msi
${{ env.DIST_DIR }}/WindowThumbWall-${{ env.VERSION }}-win-*.msix
${{ env.DIST_DIR }}/release-notes.md
${{ env.DIST_DIR }}/store-listing-*.md
${{ env.DIST_DIR }}/store-whats-new-*.md
if-no-files-found: error
release:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: windows-latest
permissions:
contents: write
env:
DIST_DIR: dist
steps:
- name: Download unsigned artifacts
uses: actions/download-artifact@v4
with:
name: unsigned-artifacts
path: ${{ env.DIST_DIR }}
- name: Create draft GitHub Release and upload assets
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b
with:
name: WindowThumbWall ${{ env.GITHUB_REF_NAME }}
body_path: ${{ env.DIST_DIR }}/release-notes.md
draft: true
files: |
${{ env.DIST_DIR }}/*.zip
${{ env.DIST_DIR }}/*.msi
${{ env.DIST_DIR }}/*.msix
fail_on_unmatched_files: true