-
-
Notifications
You must be signed in to change notification settings - Fork 41
500 lines (455 loc) · 18.3 KB
/
Copy pathrelease.yaml
File metadata and controls
500 lines (455 loc) · 18.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
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
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
name: "Build app and create release"
on:
push:
tags:
- v*.*.*
env:
SQLX_OFFLINE: "1"
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@v3
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: Install system dependencies
run: |
apt-get update
apt-get install -y git curl ca-certificates libatomic1 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
git config --global --add safe.directory '*'
- uses: actions/checkout@v7
with:
submodules: recursive
- uses: actions/setup-node@v6
with:
node-version-file: new-ui/.nvmrc
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
version: 11.11
run_install: false
- name: Get pnpm store directory
run: |
STORE_PATH=$(pnpm store path --silent)
mkdir -p "$STORE_PATH"
echo "STORE_PATH=$STORE_PATH" >> ${GITHUB_ENV}
- name: Restore pnpm store cache
uses: actions/cache@v5
with:
path: ${{ env.STORE_PATH }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('new-ui/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
- name: Write release version
run: |
VERSION=$(echo ${GITHUB_REF_NAME#v} | cut -d '-' -f1)
echo Version: $VERSION
echo "VERSION=$VERSION" >> ${GITHUB_ENV}
echo "DEFGUARD_CLIENT_BUILD_VERSION=${GITHUB_REF_NAME#v}" >> ${GITHUB_ENV}
- name: Install Node dependencies for new UI
run: |
cd new-ui
pnpm install --no-frozen-lockfile
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install tauri-cli
run: cargo install tauri-cli --locked
- name: Build new UI
run: |
cd new-ui
pnpm build
- name: Build packages
uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tauriScript: cargo tauri
args: --ignore-version-mismatches --bundles deb
- name: Upload DEB
uses: shogo82148/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: shogo82148/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_content_type: application/octet-stream
build-linux:
env:
CARGO_TERM_COLOR: always
# sccache
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
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@v7
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}
echo "DEFGUARD_CLIENT_BUILD_VERSION=${GITHUB_REF_NAME#v}" >> ${GITHUB_ENV}
- name: Install system dependencies
run: |
sudo apt-get update
sudo 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
- uses: actions/setup-node@v6
with:
node-version-file: new-ui/.nvmrc
- uses: pnpm/action-setup@v6
with:
version: 11.11
run_install: false
- name: Get pnpm store directory
shell: bash
run: |
STORE_PATH=$(pnpm store path --silent)
mkdir -p "$STORE_PATH"
echo "STORE_PATH=$STORE_PATH" >> ${GITHUB_ENV}
- name: Restore pnpm store cache
uses: actions/cache@v5
with:
path: ${{ env.STORE_PATH }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('new-ui/pnpm-lock.yaml') }}
restore-keys: |
pnpm-store-${{ runner.os }}-
- name: Install Node dependencies for new UI
run: |
cd new-ui
pnpm install --no-frozen-lockfile
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.10
- name: Install tauri-cli
run: cargo install tauri-cli --locked
- name: Build new UI
run: |
cd new-ui
pnpm build
- name: Build packages
uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tauriScript: cargo tauri
args: --ignore-version-mismatches --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: shogo82148/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_content_type: application/octet-stream
- name: Upload DEB
uses: shogo82148/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_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: shogo82148/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_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: shogo82148/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_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: shogo82148/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_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: shogo82148/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 }}.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: shogo82148/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 }}.rpm
asset_content_type: application/octet-stream
# Dedicated dg build for AlmaLinux 9 (and the RHEL 9 family: Rocky 9, RHEL 9).
# The default dg RPM is built against a newer glibc/OpenSSL and fails to run on
# Alma 9, so dg is compiled inside an almalinux:9 container to link Alma's
# glibc 2.34 and OpenSSL 3, then packaged with fpm. x86_64 only.
build-dg-alma9:
needs:
- create-release
runs-on:
- self-hosted
- Linux
- X64
container:
image: almalinux:9
env:
HOME: /root
RUSTUP_HOME: /root/.rustup
CARGO_HOME: /root/.cargo
SQLX_OFFLINE: "true"
steps:
- name: Install build prerequisites
run: |
dnf -y install git gcc gcc-c++ make openssl-devel perl pkgconfig unzip
git config --global --add safe.directory '*'
- uses: actions/checkout@v7
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 protoc
run: |
PB_REL='https://github.com/protocolbuffers/protobuf/releases'
PB_VERSION='3.20.0'
curl -LO $PB_REL/download/v$PB_VERSION/protoc-$PB_VERSION-linux-x86_64.zip
unzip -o protoc-$PB_VERSION-linux-x86_64.zip bin/protoc 'include/google/*' -d /usr/local
echo "PROTOC=/usr/local/bin/protoc" >> ${GITHUB_ENV}
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Build dg (AlmaLinux 9)
run: cargo build --release --manifest-path src-tauri/Cargo.toml -p defguard-dg --bin dg
- name: Rename dg binary
run: mv src-tauri/target/release/dg dg-linux-x86_64-${{ github.ref_name }}
- name: Build dg rpm
uses: defGuard/fpm-action@main
with:
fpm_args: "dg-linux-x86_64-${{ 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 x86_64 --debug --output-type rpm --version ${{ env.VERSION }} --no-auto-depends --depends openssl-libs --depends wireguard-tools --package dg-linux-x86_64-${{ github.ref_name }}-el9.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-x86_64-${{ github.ref_name }}-el9.rpm
asset_name: dg-linux-x86_64-${{ github.ref_name }}-el9.rpm
asset_content_type: application/octet-stream
build-macos:
needs:
- create-release
uses: ./.github/workflows/release-macos.yaml
secrets: inherit
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
# 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@v7
# 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: 26
# - uses: pnpm/action-setup@v6
# with:
# version: 11
# run_install: false
# - name: Get pnpm store directory
# shell: bash
# run: echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV}
# - 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@v1
# 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: shogo82148/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