hololake-platform/.github/workflows/build-windows-manual.yml

107 lines
3.5 KiB
YAML

name: Build Windows Installer
on:
workflow_dispatch:
inputs:
version:
description: "Installer version to write into the Tauri bundle"
required: true
default: "0.1.1"
artifact_name:
description: "Uploaded artifact name"
required: true
default: "HoloLake-Era-Windows-x64"
env:
NODE_OPTIONS: --max-old-space-size=4096
RUST_TARGET_CACHE_VERSION: v2026-04-14-hololake-era-windows-manual
jobs:
build-windows:
name: Build Windows x64 installer
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@f40ffcd9367d9f12939873eb1018b921a783ffaa
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "pnpm"
- name: Setup Rust
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8
with:
targets: x86_64-pc-windows-msvc
- name: Cache Rust dependencies
uses: actions/cache@v4
with:
path: |
~\.cargo\registry
~\.cargo\git
src-tauri\target
key: ${{ runner.os }}-manual-windows-cargo-x86_64-pc-windows-msvc-${{ env.RUST_TARGET_CACHE_VERSION }}-${{ hashFiles('src-tauri/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-manual-windows-cargo-x86_64-pc-windows-msvc-${{ env.RUST_TARGET_CACHE_VERSION }}-
- name: Cache Tauri Windows tools
uses: actions/cache@v4
with:
path: ~\AppData\Local\tauri
key: ${{ runner.os }}-tauri-tools-nsis-3.11-nsis-tauri-utils-0.5.3
- name: Prefetch Tauri NSIS toolchain
shell: pwsh
run: ./.github/scripts/prefetch-tauri-nsis.ps1
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Set app version
shell: pwsh
run: |
$version = "${{ inputs.version }}"
$tauri = Get-Content "src-tauri/tauri.conf.json" | ConvertFrom-Json
$tauri.version = $version
$tauri | ConvertTo-Json -Depth 100 | Set-Content "src-tauri/tauri.conf.json"
(Get-Content "src-tauri/Cargo.toml") -replace '^version = ".*"$', "version = `"$version`"" | Set-Content "src-tauri/Cargo.toml"
- name: Build NSIS installer
shell: pwsh
env:
VITE_SENTRY_DSN: ""
SENTRY_DSN: ""
VITE_POSTHOG_KEY: ""
VITE_POSTHOG_HOST: ""
run: pnpm tauri build --target x86_64-pc-windows-msvc --bundles nsis
- name: Validate installer
shell: pwsh
run: |
$installers = @(Get-ChildItem -Path "src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis" -Filter "*-setup.exe" -File -ErrorAction SilentlyContinue)
if ($installers.Count -eq 0) {
throw "Windows build produced no NSIS setup executable."
}
foreach ($installer in $installers) {
if ($installer.Name -notlike "*${{ inputs.version }}*") {
throw "Windows installer has unexpected version in filename: $($installer.Name)"
}
Write-Host "Built Windows installer: $($installer.FullName)"
}
- name: Upload Windows installer
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact_name }}
path: |
src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*-setup.exe
if-no-files-found: error
retention-days: 7