-
Notifications
You must be signed in to change notification settings - Fork 66
237 lines (215 loc) · 8.54 KB
/
build-windows-pupnet.yaml
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
name: Build Windows (PupNet)
on:
workflow_call:
inputs:
AppVersion:
type: string
required: false
description: "The version of the application to build"
default: "1.0.0"
Target:
description: "The git ref to base the release on (eg: '1957a8e7', default: current head of the branch the workflow is run on)"
required: false
type: string
PupNetRepo:
type: string
required: false
description: "The URL of the PupNet repository"
default: "https://github.com/kuiperzone/PupNet-Deploy.git"
PupNetBranch:
type: string
required: false
description: "The branch or commit of PupNet to use"
default: "dabed0cc2063c5a2d2c4f780bb6718f4b90cfd16"
ProjectFile:
type: string
required: true
description: "The relative path to the project to build"
RetentionDays:
type: number
required: false
default: 1
description: "The amount of days for the artifact to persist"
BuildInnoSetup:
type: boolean
description: "Build an Inno Setup?"
required: false
default: true
BuildArchive:
type: boolean
description: "Build an Archive?"
required: false
default: true
SignExecutable:
type: boolean
description: "Sign the executable on Windows?"
required: false
default: false
secrets:
ES_USERNAME:
description: "The SSL.com account username."
required: false
ES_PASSWORD:
description: "The SSL.com account password."
required: false
ES_CREDENTIAL_ID:
description: "The Credential ID for signing certificate."
required: false
ES_TOTP_SECRET:
description: "The OAuth TOTP secret."
required: false
outputs:
ArtifactNameWindowsArchive:
description: "Name of the Artifact that contains the Windows Archive"
value: ${{ jobs.build-archive.outputs.artifactName }}
ArtifactUrlWindowsArchive:
description: "URL to download the Windows Archive artifact"
value: ${{ jobs.build-archive.outputs.artifactUrl }}
ArtifactNameWindowsInnoSetup:
description: "Name of the Artifact that contains the Windows Inno Setup"
value: ${{ jobs.build-setup.outputs.artifactName }}
ArtifactUrlWindowsInnoSetup:
description: "URL to download the Windows InnoSetup artifact"
value: ${{ jobs.build-setup.outputs.artifactUrl }}
jobs:
build-archive:
if: inputs.BuildArchive
runs-on: windows-latest
outputs:
artifactName: ${{ steps.setOutputs.outputs.artifactName }}
artifactUrl: ${{ steps.upload.outputs.artifact-url }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.Target || github.sha }}
submodules: "recursive"
- name: Setup .NET 9.x
uses: actions/setup-dotnet@v4
id: stepid
with:
dotnet-version: '9.x'
- name: Print debug info
run: dotnet --info
- name: Transform inputs
id: transformInputs
shell: pwsh
env:
ProjectFile: ${{ inputs.ProjectFile }}
run: |
$projectDir = [System.IO.Path]::GetDirectoryName("$env:ProjectFile")
$projectName = [System.IO.Path]::GetFileNameWithoutExtension("$env:ProjectFile")
echo "projectDir=$projectDir" >> $env:GITHUB_OUTPUT
echo "projectName=$projectName" >> $env:GITHUB_OUTPUT
- name: Build & Install PupNet
run: |
# Our use of central package management may cause PupNet to fail build
# so we lift it out to a separate directory and build it there
mkdir ../PupNet
cd ../PupNet
git clone ${{ inputs.PupNetRepo }} .
git checkout ${{ inputs.PupNetBranch }}
dotnet pack -c Release -o . -p:Version=0.0.0-nma
dotnet tool install --global --add-source . KuiperZone.PupNet --version 0.0.0-nma
- name: Download CodeSignTool
id: downloadCodeSignTool
shell: pwsh
run: ./scripts/download-codesigntool.ps1
- name: Create Archive
working-directory: ${{ steps.transformInputs.outputs.projectDir }}
run: pupnet -y -v ${{ inputs.AppVersion }} -k zip -p DefineConstants=INSTALLATION_METHOD_ARCHIVE
env:
SignExecutable: ${{ inputs.SignExecutable }}
CodeSignToolDir: ${{ steps.downloadCodeSignTool.outputs.codeSignToolDir }}
ES_USERNAME: ${{ secrets.ES_USERNAME }}
ES_PASSWORD: ${{ secrets.ES_PASSWORD }}
ES_CREDENTIAL_ID: ${{ secrets.ES_CREDENTIAL_ID }}
ES_TOTP_SECRET: ${{ secrets.ES_TOTP_SECRET }}
- name: Set outputs
id: setOutputs
shell: pwsh
run: |
echo "artifactName=${{ steps.transformInputs.outputs.projectName }}-${{ inputs.Target || github.sha }}-Windows-Archive" >> $env:GITHUB_OUTPUT
- name: Upload
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ steps.setOutputs.outputs.artifactName }}
path: ${{ steps.transformInputs.outputs.projectDir }}/Deploy/OUT/*.zip
if-no-files-found: error
retention-days: ${{ inputs.RetentionDays }}
build-setup:
runs-on: windows-latest
if: inputs.BuildInnoSetup
outputs:
artifactName: ${{ steps.setOutputs.outputs.artifactName }}
artifactUrl: ${{ steps.upload.outputs.artifact-url }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.Target || github.sha }}
submodules: "recursive"
- name: Transform inputs
id: transformInputs
shell: pwsh
env:
ProjectFile: ${{ inputs.ProjectFile }}
run: |
$projectDir = [System.IO.Path]::GetDirectoryName("$env:ProjectFile")
$projectName = [System.IO.Path]::GetFileNameWithoutExtension("$env:ProjectFile")
echo "projectDir=$projectDir" >> $env:GITHUB_OUTPUT
echo "projectName=$projectName" >> $env:GITHUB_OUTPUT
- name: Setup .NET 9.x
uses: actions/setup-dotnet@v4
id: stepid
with:
dotnet-version: '9.x'
- name: Print debug info
run: dotnet --info
- name: Build & Install PupNet
run: |
# Our use of central package management may cause PupNet to fail build
# so we lift it out to a separate directory and build it there
mkdir ../PupNet
cd ../PupNet
git clone ${{ inputs.PupNetRepo }} .
git checkout ${{ inputs.PupNetBranch }}
dotnet pack -c Release -o . -p:Version=0.0.0-nma
dotnet tool install --global --add-source . KuiperZone.PupNet --version 0.0.0-nma
- name: Download CodeSignTool
id: downloadCodeSignTool
shell: pwsh
run: ./scripts/download-codesigntool.ps1
- name: Create Setup
working-directory: ${{ steps.transformInputs.outputs.projectDir }}
run: pupnet -y -v ${{ inputs.AppVersion }} -k Setup -p DefineConstants=INSTALLATION_METHOD_INNO_SETUP
env:
SignExecutable: ${{ inputs.SignExecutable }}
CodeSignToolDir: ${{ steps.downloadCodeSignTool.outputs.codeSignToolDir }}
ES_USERNAME: ${{ secrets.ES_USERNAME }}
ES_PASSWORD: ${{ secrets.ES_PASSWORD }}
ES_CREDENTIAL_ID: ${{ secrets.ES_CREDENTIAL_ID }}
ES_TOTP_SECRET: ${{ secrets.ES_TOTP_SECRET }}
- name: Sign Setup
if: inputs.SignExecutable == true
working-directory: ${{ steps.transformInputs.outputs.projectDir }}
run: ../../scripts/sign.ps1 Deploy/OUT
env:
SignExecutable: ${{ inputs.SignExecutable }}
CodeSignToolDir: ${{ steps.downloadCodeSignTool.outputs.codeSignToolDir }}
ES_USERNAME: ${{ secrets.ES_USERNAME }}
ES_PASSWORD: ${{ secrets.ES_PASSWORD }}
ES_CREDENTIAL_ID: ${{ secrets.ES_CREDENTIAL_ID }}
ES_TOTP_SECRET: ${{ secrets.ES_TOTP_SECRET }}
- name: Set outputs
id: setOutputs
shell: pwsh
run: |
echo "artifactName=${{ steps.transformInputs.outputs.projectName }}-${{ inputs.Target || github.sha }}-Windows-Setup" >> $env:GITHUB_OUTPUT
- name: Upload
id: upload
uses: actions/upload-artifact@v4
with:
name: ${{ steps.setOutputs.outputs.artifactName }}
path: ${{ steps.transformInputs.outputs.projectDir }}/Deploy/OUT/*.exe
if-no-files-found: error
retention-days: ${{ inputs.RetentionDays }}