windows build #256
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: windows build | |
on: | |
workflow_call: | |
workflow_dispatch: | |
env: | |
BUILD_ARCHS: "32 64" | |
BUILD_TYPES: ${{ (github.ref_name == 'develop' || github.ref_name == 'main') && 'Release Debug' || 'Release' }} | |
BUILD_TESTING: ${{ (github.ref_name != 'main') && '-BuildTesting' || '' }} | |
jobs: | |
prepare-build-matrix: | |
runs-on: ubuntu-24.04 | |
outputs: | |
archs: ${{ steps.matrix-vars.outputs.ARCHS }} | |
types: ${{ steps.matrix-vars.outputs.TYPES }} | |
build-args: ${{ steps.matrix-vars.outputs.BUILD_ARGS }} | |
steps: | |
- name: Calculate matrix variables | |
id: matrix-vars | |
run: | | |
echo ARCHS=[\"$BUILD_ARCHS\"] | sed 's| |","|g' >> "$GITHUB_OUTPUT" | |
echo TYPES=[\"$BUILD_TYPES\"] | sed 's| |","|g' >> "$GITHUB_OUTPUT" | |
BUILD_ARGS=$BUILD_TESTING | |
for BUILD_PARAM in $BUILD_ARCHS $BUILD_TYPES; do | |
BUILD_ARGS=$(echo $BUILD_ARGS -Build$BUILD_PARAM | xargs) | |
done | |
echo BUILD_ARGS=$BUILD_ARGS >> "$GITHUB_OUTPUT" | |
build-bin: | |
runs-on: windows-2022 | |
needs: prepare-build-matrix | |
strategy: | |
matrix: | |
arch: ${{ fromJSON(needs.prepare-build-matrix.outputs.archs) }} | |
type: ${{ fromJSON(needs.prepare-build-matrix.outputs.types) }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Prepare build environment | |
run: | | |
$ProgressPreference = "SilentlyContinue" | |
Invoke-WebRequest https://github.com/nzbgetcom/build-files/releases/download/v1.0/vcpkg-windows-x${{ matrix.arch }}.zip -OutFile "${{ github.workspace }}\vcpkg.zip" | |
Rename-Item -path "C:\vcpkg" -NewName "C:\vcpkg.old" | |
Expand-Archive -Path "${{ github.workspace }}\vcpkg.zip" -DestinationPath C:\ | |
Invoke-WebRequest https://github.com/nzbgetcom/build-files/releases/download/v1.0/nzbget-windows-tools.zip -OutFile "${{ github.workspace }}\tools.zip" | |
Expand-Archive -Path "${{ github.workspace }}\tools.zip" -DestinationPath C:\ | |
- name: Build nzbget ${{ matrix.arch }}-bit / ${{ matrix.type }} binary | |
run: Invoke-Expression "windows\build-nzbget.ps1 -Build${{ matrix.type }} -Build${{ matrix.arch }} ${{ env.BUILD_TESTING }}" | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.type }}${{ matrix.arch }} | |
path: | | |
build\${{ matrix.type }}${{ matrix.arch }}\${{ matrix.type }}\*.exe | |
build\${{ matrix.type }}${{ matrix.arch }}\*.nsi | |
retention-days: 5 | |
build-installer: | |
runs-on: windows-2022 | |
needs: [build-bin, prepare-build-matrix] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
- name: Prepare build environment | |
run: | | |
$ProgressPreference = "SilentlyContinue" | |
Invoke-WebRequest https://github.com/nzbgetcom/build-files/releases/download/v1.0/nzbget-windows-tools.zip -OutFile "${{ github.workspace }}\tools.zip" | |
Expand-Archive -Path "${{ github.workspace }}\tools.zip" -DestinationPath C:\ | |
New-Item build -ItemType Directory -ErrorAction SilentlyContinue | Out-Null | |
Copy-Item Release* build -Recurse -ErrorAction SilentlyContinue | |
Copy-Item Debug* build -Recurse -ErrorAction SilentlyContinue | |
- name: Build nzbget windows installer | |
run: Invoke-Expression "windows\build-nzbget.ps1 -BuildSetup ${{ needs.prepare-build-matrix.outputs.build-args }}" | |
- name: Rename build artifacts | |
if: github.ref_name != 'main' && github.ref_name != 'develop' | |
run: | | |
$Output="build" | |
$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("-bin-windows-", "-$Suffix-bin-windows-") | |
} | |
- name: Delete unneeded platform-specific artifacts | |
uses: geekyeggo/delete-artifact@v5 | |
with: | |
name: | | |
Release* | |
Debug* | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nzbget-windows-installers | |
path: build\*.exe | |
retention-days: 5 |