Skip to content

windows build

windows build #72

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@v3
- 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
echo "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'
run: |
$Output="c:\nzbget\build\output"
$NewVersion=$env:NEW_VERSION
ForEach ($File In Get-ChildItem -Path $Output -Filter "*.exe") {
If ($env:GITHUB_REF_NAME -ne "main") {
if ($env:GITHUB_REF_NAME -ne "develop") {
$Suffix = $env:GITHUB_REF_NAME.Replace("/","-")
Rename-Item -Path "$Output\$($File.Name)" -NewName $File.Name.Replace($NewVersion, "$NewVersion-$Suffix")
}
}
}
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: nzbget-windows-installers
path: C:\nzbget\build\output\*.exe
retention-days: 5