Skip to content

Build and Release Installer #41

Build and Release Installer

Build and Release Installer #41

Workflow file for this run

name: Build and Release Installer
on:
release:
types: [created]
workflow_dispatch:
inputs:
tag:
description: 'Release tag to create/upload to (e.g. v0.7.0)'
required: false
type: string
jobs:
build:
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET 10
run: |
$v = dotnet --version 2>$null
if ($v -and $v.StartsWith('10.')) {
Write-Host ".NET $v already installed — skipping download"
} else {
Write-Host "Installing .NET 10..."
Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -OutFile 'dotnet-install.ps1'
.\dotnet-install.ps1 -Channel '10.0' -InstallDir "$env:LOCALAPPDATA\Microsoft\dotnet"
$env:PATH = "$env:LOCALAPPDATA\Microsoft\dotnet;$env:PATH"
Write-Host "Installed: $(dotnet --version)"
}
shell: pwsh
- name: Install NSIS
run: choco install nsis --yes
shell: pwsh
- name: Publish 64-bit self-contained app
run: |
dotnet publish Yaesu_Web_Control.csproj `
--configuration Release `
--runtime win-x64 `
--self-contained true `
--output publish
shell: pwsh
- name: List publish output
run: |
Write-Host "=== publish\\ ==="
if (Test-Path publish) { Get-ChildItem publish -Name } else { Write-Host "publish dir missing!" }
Write-Host "=== root ==="
Get-ChildItem -Name
shell: pwsh
- name: Build NSIS installer
run: |
$makensis = (Get-Command makensis.exe -ErrorAction SilentlyContinue)?.Source
if (-not $makensis) { $makensis = "C:\\Program Files (x86)\\NSIS\\makensis.exe" }
if (!(Test-Path $makensis)) { Write-Error "makensis.exe not found at $makensis"; exit 1 }
Write-Host "Using NSIS at: $makensis"
& $makensis installer.nsi
if ($LASTEXITCODE -ne 0) { Write-Error "NSIS failed (exit $LASTEXITCODE)"; exit 1 }
$found = Get-ChildItem -Filter "*Setup*.exe" | Select-Object -First 1
if (!$found) { Write-Error "No *Setup*.exe found after NSIS ran"; exit 1 }
Write-Host "NSIS produced: $($found.FullName)"
if ($found.Name -ne "Yaesu_Web_Control_Setup.exe") {
Rename-Item $found.FullName "Yaesu_Web_Control_Setup.exe"
Write-Host "Renamed to Yaesu_Web_Control_Setup.exe"
}
shell: pwsh
- name: Verify installer was created
run: |
if (!(Test-Path "Yaesu_Web_Control_Setup.exe")) {
Write-Error "Yaesu_Web_Control_Setup.exe not found after build"
exit 1
}
Write-Host "OK: $('{0:N0}' -f (Get-Item Yaesu_Web_Control_Setup.exe).Length) bytes"
shell: pwsh
- name: Upload installer to GitHub Release
run: |
# release event carries tag in GITHUB_REF_NAME; dispatch uses the input
if ("${{ github.event_name }}" -eq "release") {
$tag = $env:GITHUB_REF_NAME
} else {
$tag = "${{ github.event.inputs.tag }}"
}
Write-Host "Uploading installer to release: $tag"
gh release upload "$tag" "Yaesu_Web_Control_Setup.exe" --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: pwsh