netx/.github/workflows/release-windows.yml

55 lines
1.8 KiB
YAML

name: Release Windows
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Build release stage
shell: pwsh
run: |
# Use pwsh -File (UTF-8). Nested Windows PowerShell 5.1 mis-parses UTF-8 scripts without BOM.
& ./packaging/build_release.ps1 -CreateVenv
- name: Install Inno Setup
shell: pwsh
run: |
choco install innosetup -y --no-progress
echo "C:\Program Files (x86)\Inno Setup 6" >> $env:GITHUB_PATH
- name: Compile installer
shell: pwsh
run: |
$ver = (Get-Content pyproject.toml | Select-String '^\s*version\s*=').Line -replace '.*"(.+)"','$1'
if ($env:GITHUB_REF_NAME -ne "v$ver") { throw "Release tag $env:GITHUB_REF_NAME does not match pyproject version $ver" }
ISCC.exe "/DMyAppVersion=$ver" packaging/installer/netx.iss
if ($LASTEXITCODE -ne 0) { throw "Inno Setup failed with exit code $LASTEXITCODE" }
$setup = "packaging/release/NetX-Setup-$ver.exe"
if (-not (Test-Path $setup) -or (Get-Item $setup).Length -lt 1MB) { throw "Missing or invalid installer: $setup" }
$hash = (Get-FileHash $setup -Algorithm SHA256).Hash.ToLowerInvariant()
Set-Content "$setup.sha256" -Value $hash -Encoding ascii -NoNewline
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
packaging/release/NetX-Setup-*.exe
packaging/release/NetX-Setup-*.exe.sha256
generate_release_notes: true