-
Notifications
You must be signed in to change notification settings - Fork 6
264 lines (250 loc) · 8.52 KB
/
frontends.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
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
name: Release naisdevice
on:
push:
branches:
- master
tags:
- "*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-22.04", "macOS-latest"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- id: tool_versions
run: echo "go=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.tool_versions.outputs.go }}
- if: matrix.os == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install --yes build-essential
- run: "make test"
- run: "make check"
- run: "go vet ./..."
set-version:
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.set-version.outputs.version }}
steps:
- uses: actions/checkout@v4
- name: set version
id: set-version
run: echo "version=${GITHUB_REF#refs/*/}" >> ${GITHUB_OUTPUT}
build-windows:
needs:
- set-version
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- gotags: ""
output-suffix: ""
- gotags: "tenant"
output-suffix: "-tenant"
steps:
- uses: actions/checkout@v4
- id: tool_versions
run: echo "go=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.tool_versions.outputs.go }}
- name: build binaries and installer
env:
MSI_SIGN_CERT: "${{ secrets.MSI_SIGN_CERT }}"
MSI_SIGN_KEY: "${{ secrets.MSI_SIGN_KEY }}"
run: |
sudo apt-get update
sudo apt-get install --yes nsis osslsigncode
echo "${MSI_SIGN_CERT}" > packaging/windows/naisdevice.crt
echo "${MSI_SIGN_KEY}" > packaging/windows/naisdevice.key
make nsis GOTAGS=${{ matrix.gotags }} VERSION=${{ needs.set-version.outputs.version }}
md5sum bin/windows-client/*
md5sum packaging/windows/naisdevice.exe
- name: upload windows-client
uses: actions/upload-artifact@v3
with:
name: windows-client${{ matrix.output-suffix }}
path: bin/windows-client
if-no-files-found: error
- name: upload windows-installer
uses: actions/upload-artifact@v3
with:
name: windows-installer${{ matrix.output-suffix }}
path: packaging/windows/naisdevice.exe
if-no-files-found: error
build-macos:
strategy:
matrix:
include:
- gotags: ""
output-suffix: ""
- gotags: "tenant"
output-suffix: "-tenant"
needs:
- set-version
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- id: tool_versions
run: echo "go=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.tool_versions.outputs.go }}
- name: Import Code-Signing Certificates
uses: Apple-Actions/import-codesign-certs@v2
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }}
- name: build pkg
env:
APPLE_NOTARIZE_AUTH_KEY_P8_BASE64: "${{ secrets.APPLE_NOTARIZE_AUTH_KEY_P8_BASE64 }}"
APPLE_NOTARIZE_D: "${{ secrets.APPLE_NOTARIZE_D }}"
APPLE_NOTARIZE_I: "${{ secrets.APPLE_NOTARIZE_I }}"
run: |
brew install imagemagick
make pkg GOTAGS=${{ matrix.gotags }} VERSION=${{ needs.set-version.outputs.version }} RELEASE=${{ startsWith(github.ref, 'refs/tags/') && 'true' || 'false' }}
md5 bin/macos-client/*
md5 naisdevice.pkg
- name: upload pkg
uses: actions/upload-artifact@v3
with:
name: pkg${{ matrix.output-suffix }}
path: naisdevice.pkg
if-no-files-found: error
build-linux:
strategy:
matrix:
include:
- gotags: ""
output-suffix: ""
- gotags: "tenant"
output-suffix: "-tenant"
needs:
- set-version
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- id: tool_versions
run: echo "go=$(grep golang .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT
- uses: actions/setup-go@v5
with:
go-version: ${{ steps.tool_versions.outputs.go }}
- name: create debian package
env:
SUFFIX: "${{ matrix.output-suffix }}"
run: |
sudo apt-get update
sudo apt-get install --yes build-essential ruby ruby-dev rubygems
sudo gem install --no-document fpm -v 1.15.1
make deb GOTAGS=${{ matrix.gotags }} VERSION=${{ needs.set-version.outputs.version }}
md5sum naisdevice*.deb
- name: upload debian package
uses: actions/upload-artifact@v3
with:
name: deb${{ matrix.output-suffix }}
path: naisdevice*.deb
if-no-files-found: error
new_release:
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
needs:
- set-version
- test
- build-macos
- build-windows
- build-linux
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: create release
id: create_release
uses: softprops/[email protected]
with:
tag_name: ${{ needs.set-version.outputs.version }}
release_name: Release ${{ needs.set-version.outputs.version }}
draft: false
prerelease: false
generate_release_notes: true
release:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
output-suffix: ["", "-tenant"]
needs:
- set-version
- test
- build-macos
- build-windows
- build-linux
- new_release
runs-on: ubuntu-22.04
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: download windows installer
uses: actions/download-artifact@v3
with:
name: windows-installer${{ matrix.output-suffix }}
- name: Calculate checksum
run: |
sha256sum naisdevice.exe | awk {'print $1}' > naisdevice.exe.sha256
- name: upload naisdevice.exe
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.new_release.outputs.upload_url }}
asset_path: ./naisdevice.exe
asset_name: naisdevice${{ matrix.output-suffix }}.exe
asset_content_type: application/octet-stream
- name: upload naisdevice.exe.sha256
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.new_release.outputs.upload_url }}
asset_path: ./naisdevice.exe.sha256
asset_name: naisdevice${{ matrix.output-suffix }}.exe.sha256
asset_content_type: text/plain
- name: download pkg
uses: actions/download-artifact@v3
with:
name: pkg${{ matrix.output-suffix }}
- name: Calculate checksum
run: |
sha256sum naisdevice.pkg | awk {'print $1}' > naisdevice.pkg.sha256
- name: upload macos pkg to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.new_release.outputs.upload_url }}
asset_path: ./naisdevice.pkg
asset_name: naisdevice${{ matrix.output-suffix }}.pkg
asset_content_type: application/octet-stream
- name: upload macos pkg checksum to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.new_release.outputs.upload_url }}
asset_path: ./naisdevice.pkg.sha256
asset_name: naisdevice${{ matrix.output-suffix }}.pkg.sha256
asset_content_type: text/plain
- name: download deb
uses: actions/download-artifact@v3
with:
name: deb${{ matrix.output-suffix }}
- name: upload debian package to release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ needs.new_release.outputs.upload_url }}
asset_path: ./naisdevice${{ matrix.output-suffix }}_${{ needs.set-version.outputs.version }}_amd64.deb
asset_name: naisdevice${{ matrix.output-suffix }}.deb
asset_content_type: application/octet-stream