-
Notifications
You must be signed in to change notification settings - Fork 3
304 lines (275 loc) · 10.9 KB
/
release.yml
File metadata and controls
304 lines (275 loc) · 10.9 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
name: Make a new release
on:
push:
branches:
- pkg
tags:
- v*.*.*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
SQLX_OFFLINE: "1"
# sccache
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
jobs:
build-docker-release:
# Ignore tags with -, like v1.0.0-alpha
if: startsWith(github.ref, 'refs/tags/') && !contains(github.ref, '-')
name: Build Release Docker image
uses: ./.github/workflows/build-docker.yml
with:
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
# Explicitly disable latest tag. It will be added otherwise.
flavor: |
latest=false
build-docker-prerelease:
# Only build tags with -, like v1.0.0-alpha
if: startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-')
name: Build Pre-release Docker image
uses: ./.github/workflows/build-docker.yml
with:
tags: |
type=raw,value=pre-release
type=semver,pattern={{version}}
type=sha
# Explicitly disable latest tag. It will be added otherwise.
flavor: |
latest=false
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: shogo82148/actions-create-release@v1
with:
draft: true
generate_release_notes: true
release_name: pkg
tag_name: pkg
create-sbom:
needs:
- create-release
- build-docker-release
uses: ./.github/workflows/sbom.yml
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
build-binaries:
needs:
- create-release
runs-on:
- self-hosted
- Linux
- X64
steps:
# Store the version, stripping any v-prefix
- name: Write release version
run: |
VERSION=${GITHUB_REF_NAME#v}
echo Version: $VERSION
echo "VERSION=2.0.0" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- name: Install NodeJS
uses: actions/setup-node@v6
with:
node-version: 25
- name: Install pnpm
uses: pnpm/action-setup@v6
with:
cache: true
version: 10
- name: Build frontend
working-directory: web
run: |
pnpm install --ignore-scripts --frozen-lockfile
pnpm build
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: "aarch64-unknown-linux-gnu"
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Build Linux x86_64 binary
run: |
cargo build --locked --release --target x86_64-unknown-linux-gnu
mv target/x86_64-unknown-linux-gnu/release/defguard-proxy defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu
tar -zcf defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz \
defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu
- name: Build Linux aarch64 binary
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
PKG_CONFIG_SYSROOT_DIR: /usr/lib/aarch64-linux-gnu
run: |
cargo build --locked --release --target aarch64-unknown-linux-gnu
mv target/aarch64-unknown-linux-gnu/release/defguard-proxy defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu
tar -zcf defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz \
defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu
- name: Build FreeBSD binary
run: |
rsync -rlptxzH -e 'ssh -l root' --del ./ freebsd:work/edge/
ssh root@freebsd 'cd work/edge && cargo build --locked --release'
scp root@freebsd:work/edge/target/release/defguard-proxy defguard-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd
tar -zcf defguard-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd.tar.gz \
defguard-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd
- name: Build x86_64 DEB package
uses: defGuard/fpm-action@main
with:
fpm_args:
"defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-proxy
linux/defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
example-config.toml=/etc/defguard/proxy.toml"
fpm_opts:
"--architecture amd64
--output-type deb
--version ${{ env.VERSION }}
--package defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb
--before-install linux/preinst
--after-install linux/postinst
--before-remove linux/prerm
--after-remove linux/postrm"
- name: Build aarch64 DEB package
uses: defGuard/fpm-action@main
with:
fpm_args:
"defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-proxy
linux/defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
example-config.toml=/etc/defguard/proxy.toml"
fpm_opts:
"--architecture arm64
--output-type deb
--version ${{ env.VERSION }}
--package defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.deb
--before-install linux/preinst
--after-install linux/postinst
--before-remove linux/prerm
--after-remove linux/postrm"
- name: Build x86_64 RPM package
uses: defGuard/fpm-action@main
with:
fpm_args:
"defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-proxy
linux/defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
example-config.toml=/etc/defguard/proxy.toml"
fpm_opts:
"--architecture amd64
--output-type rpm
--version ${{ env.VERSION }}
--package defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.rpm
--before-install linux/preinst
--after-install linux/postinst
--before-remove linux/prerm
--after-remove linux/postrm"
- name: Build aarch64 RPM package
uses: defGuard/fpm-action@main
with:
fpm_args:
"defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-proxy
linux/defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
example-config.toml=/etc/defguard/proxy.toml"
fpm_opts:
"--architecture arm64
--output-type rpm
--version ${{ env.VERSION }}
--package defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.rpm
--before-install linux/preinst
--after-install linux/postinst
--before-remove linux/prerm
--after-remove linux/postrm"
- name: Build FreeBSD package
uses: defGuard/fpm-action@main
with:
fpm_args:
"defguard-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-proxy
freebsd/defguard-proxy=/usr/local/etc/rc.d/defguard-proxy
example-config.toml=/etc/defguard/proxy.toml"
fpm_opts:
"--architecture amd64
--output-type freebsd
--version ${{ env.VERSION }}
--package defguard-proxy-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg
--freebsd-osversion '*'
--depends openssl
--before-install freebsd/preinst
--after-remove freebsd/postrm"
- name: Upload Linux x86_64 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-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz
asset_content_type: application/gzip
overwrite: true
- name: Upload Linux aarch64 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-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz
asset_content_type: application/gzip
overwrite: true
- name: Upload FreeBSD x86_64 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-proxy-${{ env.VERSION }}-x86_64-unknown-freebsd.tar.gz
asset_content_type: application/gzip
overwrite: true
- name: Upload Linux x86_64 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: defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb
asset_content_type: application/gzip
overwrite: true
- name: Upload Linux aarch64 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: defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.deb
asset_content_type: application/gzip
overwrite: true
- name: Upload Linux x86_64 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: defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.rpm
asset_content_type: application/gzip
overwrite: true
- name: Upload Linux aarch64 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: defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.rpm
asset_content_type: application/gzip
overwrite: true
- name: Upload FreeBSD package
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-proxy-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg
asset_content_type: application/x-pkg
overwrite: true