-
Notifications
You must be signed in to change notification settings - Fork 190
117 lines (112 loc) · 4.08 KB
/
app-artifacts-win.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
112
113
114
115
116
117
name: Build and upload Windows app artifact
on:
workflow_dispatch:
inputs:
buildBranch:
description: 'Headlamp ref/branch/tag'
required: true
default: 'main'
signBinaries:
description: Sign the binaries
default: false
type: boolean
exe:
description: Build Exe Installer
default: true
type: boolean
msi:
description: Build Msi Installer
default: false
type: boolean
jobs:
build-windows:
runs-on: windows-2022
steps:
- name: Validate choices
if: ${{ !inputs.exe && !inputs.msi }}
shell: pwsh
run: |
echo Please choose either an exe or msi installer
exit 1
- uses: actions/checkout@v2.3.3
with:
path: build-helper
- uses: actions/checkout@v2.3.3
with:
repository: headlamp-k8s/headlamp
ref: ${{ github.event.inputs.buildBranch }}
path: headlamp
- name: Setup nodejs
uses: actions/setup-node@v1
with:
node-version: 18.x
- uses: actions/setup-go@v2
with:
go-version: '1.20.*'
- name: Dependencies
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install make
- name: "Install Wix"
if: ${{ inputs.msi }}
shell: bash
run: |
mkdir -p /mnt/c/wix
cd /mnt/c/wix
curl -sSfLO wix.zip https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip
unzip ./wix.zip
rm ./wix.zip
- name: Fetch certificates
if: ${{ inputs.signBinaries }}
shell: pwsh
run: |
az login --service-principal -u ${{ secrets.WINDOWS_CLIENT_ID }} -p ${{ secrets.AZ_LOGIN_PASS }} --tenant 72f988bf-86f1-41af-91ab-2d7cd011db47
az keyvault secret download --subscription ${{ secrets.AZ_SUBSCRIPTION_ID }} --vault-name headlamp --name HeadlampAuthCert --file c:\HeadlampAuthCert.pfx --encoding base64
az keyvault secret download --subscription ${{ secrets.AZ_SUBSCRIPTION_ID }} --vault-name headlamp --name ESRPHeadlampReqCert --file c:\HeadlampReqCert.pfx --encoding base64
- name: Set up certificates
if: ${{ inputs.signBinaries }}
shell: pwsh
run: |
Import-PfxCertificate -FilePath c:\HeadlampAuthCert.pfx -CertStoreLocation Cert:\LocalMachine\My -Exportable
Import-PfxCertificate -FilePath c:\HeadlampReqCert.pfx -CertStoreLocation Cert:\LocalMachine\My -Exportable
- name: Download and Set up ESRPClient
if: ${{ inputs.signBinaries }}
shell: pwsh
run: |
nuget.exe sources add -name esrp -source ${{ secrets.ESRP_NUGET_INDEX_URL }} -username headlamp -password ${{ secrets.AZ_DEVOPS_TOKEN }}
nuget.exe install Microsoft.EsrpClient -Version 1.2.80 -source ${{ secrets.ESRP_NUGET_INDEX_URL }} | out-null
- name: App Windows Exe
if: ${{ inputs.exe }}
shell: pwsh
working-directory: headlamp
run: |
if ("${{ inputs.signBinaries }}" -eq "true") {
$env:ESRP_PATH="$(Get-Location)\..\Microsoft.EsrpClient.1.2.80\tools\EsrpClient.exe"
$env:HEADLAMP_WINDOWS_CLIENT_ID="${{ secrets.WINDOWS_CLIENT_ID }}"
$env:HEADLAMP_WINDOWS_SIGN_EMAIL="${{ secrets.WINDOWS_SIGN_EMAIL }}"
} else {
echo "Not signing binaries"
}
$env:PATH = $env:PATH + ";C:\wix;"
make app-win
- name: App Windows MSI
if: ${{ inputs.msi }}
shell: bash
working-directory: headlamp
run: |
if ("${{ inputs.signBinaries }}" -eq "true") {
$env:ESRP_PATH="$(Get-Location)\..\Microsoft.EsrpClient.1.2.80\tools\EsrpClient.exe"
$env:HEADLAMP_WINDOWS_CLIENT_ID="${{ secrets.WINDOWS_CLIENT_ID }}"
$env:HEADLAMP_WINDOWS_SIGN_EMAIL="${{ secrets.WINDOWS_SIGN_EMAIL }}"
} else {
echo "Not signing binaries"
}
export PATH="/c/wix:$PATH"
make app-win-msi
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: Win exes
path: ./headlamp/app/dist/Headlamp*.*
if-no-files-found: error
retention-days: 2