-
Notifications
You must be signed in to change notification settings - Fork 53
168 lines (144 loc) · 6.3 KB
/
Copy pathwindows.yml
File metadata and controls
168 lines (144 loc) · 6.3 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
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' || '' }}
SIGN: ${{ (github.ref_name == 'develop' || github.ref_name == 'main') && 'true' || 'false' }}
SIGNING_POLICY: 'release-signing'
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@v6
- name: Prepare build environment
run: |
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest https://github.com/nzbgetcom/build-files/releases/download/v5.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/v10.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@v7
id: upload-unsigned-artifact
with:
name: ${{ matrix.type }}${{ matrix.arch }}
path: |
build\${{ matrix.type }}${{ matrix.arch }}\${{ matrix.type }}\*.exe
build\${{ matrix.type }}${{ matrix.arch }}\*.nsi
retention-days: 5
- name: Submit signing request
id: submit-signing-request
if: env.SIGN == 'true' && matrix.type == 'Release'
uses: signpath/github-action-submit-signing-request@v2
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: ${{ secrets.SIGNPATH_ORGANIZATION_ID }}
project-slug: nzbget
signing-policy-slug: ${{ env.SIGNING_POLICY }}
artifact-configuration-slug: nzbget-binary
github-artifact-id: ${{ steps.upload-unsigned-artifact.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: build\${{ matrix.type }}${{ matrix.arch }}\signed
- name: Upload signed build artifacts
if: env.SIGN == 'true' && matrix.type == 'Release'
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.type }}${{ matrix.arch }}
overwrite: true
path: build\${{ matrix.type }}${{ matrix.arch }}\signed
retention-days: 5
build-installer:
runs-on: windows-2022
needs: [build-bin, prepare-build-matrix]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download release build artifacts
uses: actions/download-artifact@v8
with:
pattern: Release*
- name: Download debug build artifacts
uses: actions/download-artifact@v8
with:
pattern: Debug*
- name: Prepare build environment
run: |
$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest https://github.com/nzbgetcom/build-files/releases/download/v10.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: Upload build artifacts
uses: actions/upload-artifact@v7
id: upload-unsigned-installer-artifact
with:
name: nzbget-windows-installers
path: build\*.exe
retention-days: 5
- name: Submit signing request for windows installers
id: submit-signing-request
if: env.SIGN == 'true'
uses: signpath/github-action-submit-signing-request@v2
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: ${{ secrets.SIGNPATH_ORGANIZATION_ID }}
project-slug: nzbget
signing-policy-slug: ${{ env.SIGNING_POLICY }}
artifact-configuration-slug: nzbget-installer
github-artifact-id: ${{ steps.upload-unsigned-installer-artifact.outputs.artifact-id }}
wait-for-completion: true
output-artifact-directory: build\signed
- name: Upload signed build artifacts
if: env.SIGN == 'true'
uses: actions/upload-artifact@v7
with:
name: nzbget-windows-installers
overwrite: true
path: build\signed\*.exe
retention-days: 5
- name: Delete unneeded platform-specific artifacts
uses: geekyeggo/delete-artifact@v6
with:
name: |
Release*
Debug*