Skip to content

ci: specify inno installer type for winget submission to speed up val… #6

ci: specify inno installer type for winget submission to speed up val…

ci: specify inno installer type for winget submission to speed up val… #6

Workflow file for this run

name: QuickView Build & Release
on:
push:
tags:
- 'v*'
workflow_dispatch: # Allow manual trigger
jobs:
build-and-release:
name: Build & Pack (${{ matrix.platform }})
runs-on: windows-latest
permissions:
contents: write
strategy:
matrix:
# Build for both x64 and ARM64
platform: [x64, ARM64]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: recursive # Recursively fetch submodules like vcpkg
fetch-depth: 0 # Fetch full history to support vcpkg versioning
- name: Install Essential Visual Studio 2026 (v145) Components
shell: pwsh
run: |
# Precision installation based on code analysis:
# 1. Workload.VCTools: Core compiler & MSBuild
# 2. Windows11SDK.22621: DirectX, WinRT, and System headers
# 3. VC.Tools.ARM64: Essential for the ARM64 release matrix
# 4. VC.ATL: Included for safe linking with some vcpkg dependencies
choco install visualstudio2026buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Component.Windows11SDK.22621 --add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL --includeRecommended --passive --norestart --locale en-US"
- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2
# [Optimization] Restore vcpkg installed artifacts to skip compilation
- name: Restore vcpkg Cache
id: vcpkg-cache
uses: actions/cache@v4
with:
path: |
QuickView/vcpkg_installed
${{ github.workspace }}/third_party/vcpkg/installed
${{ env.LOCALAPPDATA }}/vcpkg/archives
key: vcpkg-${{ matrix.platform }}-${{ hashFiles('QuickView/vcpkg.json') }}
restore-keys: |
vcpkg-${{ matrix.platform }}-
- name: Bootstrap vcpkg
shell: pwsh
run: |
cd third_party/vcpkg
if (-not (Test-Path "vcpkg.exe")) {
./bootstrap-vcpkg.bat
}
- name: Build Project
shell: pwsh
run: |
# Build Release configuration using project's native v145 toolset
msbuild QuickView\QuickView.sln /p:Configuration=Release /p:Platform=${{ matrix.platform }} /m
- name: Prepare Portable Version
shell: pwsh
run: |
$arch = "${{ matrix.platform }}".ToLower()
$archUpper = if ("${{ matrix.platform }}" -eq "x64") { "X64" } else { "ARM64" }
# Extract actual version from the compiled EXE to ensure filename accuracy
$exePath = "QuickView\bin\${{ matrix.platform }}\Release\QuickView.exe"
if (-not (Test-Path $exePath)) { Write-Error "EXE not found"; exit 1 }
$rawVersion = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($exePath).ProductVersion
# Format version (ensure it starts with 'v')
$tag = if ($rawVersion -like "v*") { $rawVersion } else { "v$rawVersion" }
# [Optimization] Trim trailing .0 for 4-digit versions (e.g., 5.3.0.0 -> v5.3.0)
# to match semantic versioning and ensure update mechanism compatibility.
if ($tag -match '^v\d+\.\d+\.\d+\.0$') {
$tag = $tag.Substring(0, $tag.LastIndexOf('.'))
}
echo "DETECTED_TAG=$tag" >> $env:GITHUB_ENV
echo "Detected version from EXE: $tag"
# Create temporary staging dir
New-Item -ItemType Directory -Force "Release/$arch"
New-Item -ItemType Directory -Force "Release/dist"
# Copy exe
Copy-Item $exePath "Release/$arch/QuickView.exe"
# Pack portable version Zip
$zipName = "QuickView_${tag}_${archUpper}.zip"
Compress-Archive -Path "Release/$arch/QuickView.exe" -DestinationPath "Release/dist/$zipName" -Force
- name: Build Inno Setup Installer
shell: pwsh
run: |
$arch = "${{ matrix.platform }}".ToLower()
$archUpper = if ("${{ matrix.platform }}" -eq "x64") { "X64" } else { "ARM64" }
$tag = "${{ env.DETECTED_TAG }}"
$version = $tag.TrimStart('v')
# Invoke ISCC, Output to Release/dist directly
$outputName = "QuickView_Installer_${tag}_${archUpper}"
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /DMyAppVersion=$version /DAppArch=$arch /DOutputName=$outputName /O"Release\dist" installer\QuickView.iss
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
# Use a unique name per matrix job to avoid conflicts in v4
name: QuickView-Staging-${{ matrix.platform }}
path: Release/dist/*
# New job to merge everything into one single "4-file" distribution
publish-final:
needs: build-and-release
runs-on: windows-latest
name: Consolidate & Release
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: QuickView-Staging-*
path: final-dist
merge-multiple: true # This flattens the structure!
- name: Upload Consolidated Artifact
uses: actions/upload-artifact@v4
with:
name: QuickView-Standard-Distribution
path: final-dist/*
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: final-dist/*
draft: true # Create as draft for manual review
generate_release_notes: true # Automatically summarize commits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}