-
-
Notifications
You must be signed in to change notification settings - Fork 32
415 lines (376 loc) · 15.7 KB
/
release.yaml
File metadata and controls
415 lines (376 loc) · 15.7 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
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
name: "Build app and create release"
on:
push:
tags:
- v*.*.*
jobs:
create-release:
name: create-release
runs-on: self-hosted
outputs:
upload_url: ${{ steps.release.outputs.upload_url }}
steps:
- name: Create GitHub release
id: release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
create-sbom:
needs:
- create-release
uses: ./.github/workflows/sbom.yml
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
ubuntu-22-04-build:
needs:
- create-release
runs-on:
- self-hosted
- Linux
- ${{ matrix.architecture }}
strategy:
fail-fast: false
matrix:
architecture: [ARM64, X64]
include:
- architecture: ARM64
deb_arch: arm64
binary_arch: aarch64
- architecture: X64
deb_arch: amd64
binary_arch: x86_64
container:
image: ubuntu:22.04
env:
DEBIAN_FRONTEND: noninteractive
HOME: /root
RUSTUP_HOME: /root/.rustup
CARGO_HOME: /root/.cargo
steps:
- name: git install
run: |
apt-get update
apt-get install -y git curl ca-certificates
git config --global --add safe.directory '*'
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 10
- uses: actions/setup-node@v6
with:
node-version: 25
- name: Get pnpm store directory
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV}
- name: Write release version
run: |
VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
echo Version: $VERSION
echo "VERSION=$VERSION" >> ${GITHUB_ENV}
- uses: actions/cache@v5
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-build-store-
# Change to '--frozen-lockfile' once this gets fixed:
# https://github.com/pnpm/action-setup/issues/40
- name: Install Node dependencies
run: pnpm install --no-frozen-lockfile
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: |
apt-get install -y build-essential libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip protobuf-compiler libprotobuf-dev rpm
- name: Build packages
uses: tauri-apps/tauri-action@v0.5.23
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: "--bundles deb"
- name: Upload DEB
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb
asset_name: defguard-client${{ env.VERSION }}_${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb
asset_content_type: application/octet-stream
- name: Rename dg binary
run: mv src-tauri/target/release/dg dg-linux-${{ env.VERSION }}_${{ matrix.deb_arch }}
- name: Build dg deb
uses: defGuard/fpm-action@main
with:
fpm_args: "dg-linux-${{ env.VERSION }}_${{ matrix.deb_arch }}=/usr/sbin/dg dg.service=/usr/lib/systemd/system/dg.service src-tauri/cli/.env=/etc/defguard/dg.conf"
fpm_opts: "--architecture ${{ matrix.binary_arch }} --debug --output-type deb --version ${{ env.VERSION }} --package dg-linux-${{ env.VERSION }}_${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb"
- name: Upload DEB
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dg-linux-${{ env.VERSION }}_${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb
asset_name: dg-linux-${{ env.VERSION }}_${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb
asset_content_type: application/octet-stream
build-linux:
needs:
- create-release
outputs:
deb_sha256_amd64: ${{ steps.calculate-sha256.outputs.deb_sha256_amd64 }}
runs-on:
- self-hosted
- Linux
- ${{ matrix.architecture }}
strategy:
fail-fast: false
matrix:
architecture: [ARM64, X64]
include:
- architecture: ARM64
deb_arch: arm64
binary_arch: aarch64
- architecture: X64
deb_arch: amd64
binary_arch: x86_64
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- name: Write release version
run: |
VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
echo Version: $VERSION
echo "VERSION=$VERSION" >> ${GITHUB_ENV}
- name: Install NodeJS
uses: actions/setup-node@v6
with:
node-version: 25
- uses: pnpm/action-setup@v6
with:
version: 10
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV}
- name: Setup pnpm cache
uses: actions/cache@v5
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-build-store-
# Change to '--frozen-lockfile' once this gets fixed:
# https://github.com/pnpm/action-setup/issues/40
- name: Install Node dependencies
run: pnpm install --no-frozen-lockfile
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip protobuf-compiler libprotobuf-dev rpm
- name: Build packages
uses: tauri-apps/tauri-action@v0.5.23 # .24 seems broken, TODO: update when fixed
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: "--bundles deb,rpm"
- name: Calculate DEB SHA256
id: calculate-sha256
if: matrix.deb_arch == 'amd64'
run: |
DEB_FILE="src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb"
DEB_SHA256=$(sha256sum "$DEB_FILE" | cut -d ' ' -f1)
echo "DEB SHA256: $DEB_SHA256"
echo "DEB_SHA256=$DEB_SHA256" >> ${GITHUB_ENV}
echo "deb_sha256_${{ matrix.deb_arch }}=$DEB_SHA256" >> ${GITHUB_OUTPUT}
- name: Upload RPM
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: src-tauri/target/release/bundle/rpm/defguard-client-${{ env.VERSION }}-1.${{ matrix.binary_arch }}.rpm
asset_name: defguard-client-${{ env.VERSION }}-1.${{ matrix.binary_arch }}.rpm
asset_content_type: application/octet-stream
- name: Upload DEB
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: src-tauri/target/release/bundle/deb/defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb
asset_name: defguard-client_${{ env.VERSION }}_${{ matrix.deb_arch }}.deb
asset_content_type: application/octet-stream
- name: Rename and tar client binary
run: |
mv src-tauri/target/release/defguard-client defguard-client-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
tar -zcf defguard-client-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz \
defguard-client-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
- name: Upload client archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: defguard-client-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_name: defguard-client-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_content_type: application/octet-stream
- name: Rename and tar daemon binary
run: |
mv src-tauri/target/release/defguard-service defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
tar -zcf defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz \
defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
- name: Upload daemon archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_name: defguard-service-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_content_type: application/octet-stream
- name: Rename and tar dg binary
run: |
mv src-tauri/target/release/dg dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
tar -zcf dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz \
dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}
- name: Upload dg archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_name: dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.tar.gz
asset_content_type: application/octet-stream
- name: Build dg deb
uses: defGuard/fpm-action@main
with:
fpm_args: "dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}=/usr/sbin/dg dg.service=/usr/lib/systemd/system/dg.service src-tauri/cli/.env=/etc/defguard/dg.conf"
fpm_opts: "--architecture ${{ matrix.binary_arch }} --debug --output-type deb --version ${{ env.VERSION }} --package dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.deb"
- name: Upload DEB
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.deb
asset_name: dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.deb
asset_content_type: application/octet-stream
- name: Build dg rpm
uses: defGuard/fpm-action@main
with:
fpm_args: "dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}=/usr/sbin/dg dg.service=/usr/lib/systemd/system/dg.service src-tauri/cli/.env=/etc/defguard/dg.conf"
fpm_opts: "--architecture ${{ matrix.binary_arch }} --debug --output-type rpm --version ${{ env.VERSION }} --package dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.rpm"
- name: Upload RPM
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.rpm
asset_name: dg-linux-${{ matrix.binary_arch }}-${{ github.ref_name }}.rpm
asset_content_type: application/octet-stream
# Builds Windows MSI and uploads it as artifact
# build-windows:
# needs:
# - create-release
# strategy:
# fail-fast: false
# matrix:
# windows_runner:
# - windows-latest
# - windows-11-arm
# include:
# - windows_runner: windows-latest
# cpu: x64
# - windows_runner: windows-11-arm
# cpu: arm64
# runs-on: ${{ matrix.windows_runner }}
# steps:
# - uses: actions/checkout@v6
# with:
# submodules: recursive
# - name: Write release version
# run: |
# $env:VERSION=echo ($env:GITHUB_REF_NAME.Substring(1) -Split "-")[0]
# echo Version: $env:VERSION
# echo "VERSION=$env:VERSION" >> $env:GITHUB_ENV
# - uses: actions/setup-node@v6
# with:
# node-version: 25
# - uses: pnpm/action-setup@v6
# with:
# version: 10
# run_install: false
# - name: Get pnpm store directory
# shell: bash
# run: echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV}
# - uses: actions/cache@v5
# name: Setup pnpm cache
# with:
# path: ${{ env.STORE_PATH }}
# key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }}
# restore-keys: |
# ${{ runner.os }}-pnpm-build-store-
# - name: Install deps
# run: pnpm install --frozen-lockfile
# - uses: dtolnay/rust-toolchain@stable
# - name: Install Protoc
# uses: arduino/setup-protoc@v3
# with:
# repo-token: ${{ secrets.GITHUB_TOKEN }}
# - name: Build packages
# uses: tauri-apps/tauri-action@v0.5.23 # 0.5.24 - 0.6.1 give: Error: Could not find workspace directory, but version and/or name specifies to use workspace package
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Upload unsigned bundle
# uses: actions/upload-artifact@v4
# with:
# name: unsigned-bundle-${{ matrix.cpu }}
# path: src-tauri/target/release/bundle/msi/Defguard_${{ env.VERSION }}_${{ matrix.cpu }}_en-US.msi
# Signs the MSI and uploads it as release asset
# sign-bundle:
# needs:
# - create-release
# - build-windows
# strategy:
# fail-fast: false
# matrix:
# # Match CPUs from build-windows above.
# cpu:
# - x64
# - arm64
# runs-on:
# - self-hosted
# - Linux
# - X64
# steps:
# - name: Write release version
# run: |
# VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
# echo Version: $VERSION
# echo "VERSION=$VERSION" >> ${GITHUB_ENV}
# - name: Download unsigned bundle
# uses: actions/download-artifact@v4
# with:
# name: unsigned-bundle-${{ matrix.cpu }}
# - name: Sign bundle
# run: osslsigncode sign -pkcs11module /srv/codesign/certum/sc30pkcs11-3.0.6.72-MS.so -pkcs11cert ${{ secrets.CODESIGN_KEYID }} -key ${{ secrets.CODESIGN_KEYID }} -pass ${{ secrets.CODESIGN_PIN }} -h sha256 -t http://time.certum.pl/ -in Defguard_${{ env.VERSION }}_${{ matrix.cpu }}_en-US.msi -out Defguard-signed.msi
# - name: Upload installer asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ needs.create-release.outputs.upload_url }}
# asset_path: Defguard-signed.msi
# asset_name: Defguard_${{ env.VERSION }}_${{ matrix.cpu }}_en-US.msi
# asset_content_type: application/octet-stream