Skip to content

windows build

windows build #141

Workflow file for this run

name: windows build
on:
workflow_call:
workflow_dispatch:
jobs:
build:
runs-on: [self-hosted, windows]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Change version for non-release
if: github.ref_name != 'main'
run: |
$Version = ((((Select-String -Path nzbget.vcxproj -Pattern ";VERSION=")[0] -split(';'))[2] -split('='))[1]) -replace '"', ''
$Date=Get-Date -Format "yyyyMMdd"
$NewVersion = "$Version-testing-$Date"
(Get-Content nzbget.vcxproj) | ForEach-Object {$_ -replace "VERSION=`"$Version`"", "VERSION=`"$NewVersion`""} | Set-Content nzbget.vcxproj
(Get-Content windows\nzbget-setup.nsi) | ForEach-Object {$_ -replace "`"DisplayVersion`" `"$Version`"", "`"DisplayVersion`" `"$NewVersion`""} | Set-Content windows\nzbget-setup.nsi
"NEW_VERSION=$NewVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Build
run: |
.\windows\build-nzbget-vs22.bat
- name: Rename build artifacts
if: github.ref_name != 'main' && github.ref_name != 'develop'
run: |
$Output="c:\nzbget\build\output"
$NewVersion=$env:NEW_VERSION
$Suffix = $env:GITHUB_REF_NAME.Replace("/","-")
ForEach ($File In Get-ChildItem -Path $Output -Filter "*.exe") {
Rename-Item -Path "$Output\$($File.Name)" -NewName $File.Name.Replace($NewVersion, "$NewVersion-$Suffix")
}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: nzbget-windows-installers
path: C:\nzbget\build\output\*.exe
retention-days: 5