114 lines
3.8 KiB
YAML
114 lines
3.8 KiB
YAML
name: Build Windows Packages
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build-windows:
|
|
name: Build Windows
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: 'npm'
|
|
|
|
- name: Install Rust stable
|
|
shell: powershell
|
|
run: |
|
|
if (!(Get-Command rustup -ErrorAction SilentlyContinue) -and !(Test-Path "$env:USERPROFILE\.cargo\bin\rustup.exe")) {
|
|
Write-Host "Downloading rustup-init.exe..."
|
|
Invoke-WebRequest -Uri "https://win.rustup.rs/x86_64" -OutFile "$env:TEMP\rustup-init.exe"
|
|
& "$env:TEMP\rustup-init.exe" -y --default-toolchain stable --profile minimal
|
|
}
|
|
"$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
rustup default stable
|
|
rustup target add x86_64-pc-windows-msvc
|
|
|
|
- name: Rust Cache
|
|
uses: Swatinem/rust-cache@v2
|
|
continue-on-error: true
|
|
with:
|
|
workspaces: "src-tauri -> target"
|
|
|
|
- name: Install Node dependencies
|
|
run: npm ci
|
|
|
|
- name: Fetch ArgyllCMS binaries
|
|
shell: powershell
|
|
env:
|
|
ARGYLL_RELEASE_TAG: ${{ vars.ARGYLL_RELEASE_TAG }}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: npm run fetch-argyll -- --force --platform windows-x86_64
|
|
|
|
- name: Verify sidecar binaries
|
|
shell: powershell
|
|
run: |
|
|
$required = @(
|
|
"src-tauri\argyll\windows-x86_64\instlist.exe",
|
|
"src-tauri\argyll\windows-x86_64\targen.exe",
|
|
"src-tauri\argyll\windows-x86_64\chartread.exe",
|
|
"src-tauri\argyll\windows-x86_64\colprof.exe",
|
|
"src-tauri\argyll\usb\ArgyllCMS_install_USB.exe",
|
|
"src-tauri\argyll\usb\ArgyllCMS.inf"
|
|
)
|
|
foreach ($p in $required) {
|
|
if (!(Test-Path $p)) { throw "Missing required ArgyllCMS file: $p" }
|
|
}
|
|
|
|
- name: Set Release Environment
|
|
id: set_env
|
|
shell: powershell
|
|
run: |
|
|
$TAG = $env:GITHUB_REF_NAME
|
|
$SHORT_SHA = (git rev-parse --short HEAD).Trim()
|
|
"TAG=$TAG" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
"SHORT_SHA=$SHORT_SHA" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
"PREFIX=ICCery_${TAG}-${SHORT_SHA}-windows-x86_64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
|
|
|
- name: Build Tauri App
|
|
run: npm run tauri build -- -v
|
|
|
|
- name: Prepare Release Assets
|
|
shell: powershell
|
|
run: |
|
|
New-Item -ItemType Directory -Force -Path "release-assets"
|
|
$PREFIX = $env:PREFIX
|
|
|
|
# Stage MSI installer
|
|
$msiFiles = Get-ChildItem -Path "src-tauri\target\release\bundle\msi\*.msi" -ErrorAction SilentlyContinue
|
|
foreach ($file in $msiFiles) {
|
|
Copy-Item -Path $file.FullName -Destination "release-assets\$PREFIX.msi"
|
|
}
|
|
|
|
# Stage NSIS installer
|
|
$nsisFiles = Get-ChildItem -Path "src-tauri\target\release\bundle\nsis\*.exe" -ErrorAction SilentlyContinue
|
|
foreach ($file in $nsisFiles) {
|
|
Copy-Item -Path $file.FullName -Destination "release-assets\$PREFIX.exe"
|
|
# Also create a zip archive of the installer
|
|
Compress-Archive -Path $file.FullName -DestinationPath "release-assets\$PREFIX.zip" -Force
|
|
}
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ env.PREFIX }}
|
|
path: release-assets/*
|
|
|
|
- name: Release on GitHub
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
files: release-assets/*
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|