-
Notifications
You must be signed in to change notification settings - Fork 20
111 lines (92 loc) · 4.13 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
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