Skip to content

Commit ff28ecb

Browse files
committed
Test release
1 parent 01fc9f0 commit ff28ecb

4 files changed

Lines changed: 91 additions & 82 deletions

File tree

.github/workflows/cross-build.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 68 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
name: Make a new release
22
on:
33
push:
4+
# REMOVE: test only
5+
branches:
6+
- cross
47
tags:
58
- v*.*.*
69

710
concurrency:
811
group: ${{ github.workflow }}-${{ github.ref }}
912
cancel-in-progress: true
1013

14+
env:
15+
SQLX_OFFLINE: "1"
16+
1117
jobs:
1218
build-docker-release:
1319
# Ignore tags with -, like v1.0.0-alpha
@@ -44,13 +50,19 @@ jobs:
4450
upload_url: ${{ steps.release.outputs.upload_url }}
4551
steps:
4652
- name: Create GitHub release
47-
id: release
48-
uses: softprops/action-gh-release@v2
49-
if: startsWith(github.ref, 'refs/tags/')
53+
uses: softprops/action-gh-release@v3
54+
if: github.ref_type == 'tag'
5055
with:
5156
draft: true
5257
generate_release_notes: true
5358

59+
- name: Create test GitHub release
60+
uses: softprops/action-gh-release@v3
61+
if: github.ref_type != 'tag'
62+
with:
63+
draft: true
64+
name: test
65+
5466
create-sbom:
5567
needs: [create-release, build-docker-release]
5668
uses: ./.github/workflows/sbom.yml
@@ -73,8 +85,10 @@ jobs:
7385
cache: true
7486
version: 10
7587

88+
# Change to '--frozen-lockfile' once this gets fixed:
89+
# https://github.com/pnpm/action-setup/issues/40
7690
- name: Build frontend
77-
run: pnpm install --ignore-scripts --frozen-lockfile && pnpm build
91+
run: pnpm install --ignore-scripts --no-frozen-lockfile && pnpm build
7892
working-directory: web
7993

8094
build-binaries:
@@ -111,39 +125,40 @@ jobs:
111125
echo "VERSION=$VERSION" >> $GITHUB_ENV
112126
113127
- name: Install Rust stable
114-
uses: actions-rs/toolchain@v1
128+
if: matrix.build == 'linux'
129+
uses: dtolnay/rust-toolchain@stable
115130
with:
116-
toolchain: stable
117-
target: ${{ matrix.target }}
118-
override: true
131+
targets: "aarch64-unknown-linux-gnu"
119132

120133
- name: Setup `packer`
121134
uses: hashicorp/setup-packer@main
122135
id: setup
123136

124-
- name: Set up Docker BuildX
125-
uses: docker/setup-buildx-action@v4
126-
with:
127-
config-inline: |
128-
[registry."docker.io"]
129-
mirrors = ["dockerhub-proxy.teonite.net"]
130-
131137
- name: Build release binary
132-
uses: actions-rs/cargo@v1
133-
with:
134-
command: build
135-
args: --locked --release --target ${{ matrix.target }}
138+
if: matrix.build == 'linux'
139+
run: cargo build --locked --release --target ${{ matrix.target }}
140+
141+
- name: Cross-build release binary
142+
if: matrix.build == 'linux-arm64'
143+
env:
144+
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
145+
PKG_CONFIG_SYSROOT_DIR: /usr/lib/aarch64-linux-gnu
146+
run: cargo build --locked --release --target ${{ matrix.target }}
147+
148+
- name: Cross-build release binary
149+
if: matrix.build == 'freebsd'
150+
run: |
151+
rsync -rlptxzH -e 'ssh -l root' --del ./ freebsd:work/
152+
ssh root@freebsd 'cd work && cargo build --locked --release'
153+
scp root@freebsd:work/target/release/defguard-proxy defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
136154
137155
- name: Rename binary
138156
run: mv target/${{ matrix.target }}/release/defguard-proxy defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
139157

140158
- name: Tar
141-
uses: a7ul/tar-action@v1.2.0
142-
with:
143-
command: c
144-
files: |
159+
run:
160+
tar -zcf defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz \
145161
defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
146-
outPath: defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
147162

148163
- name: Upload release archive
149164
uses: actions/upload-release-asset@v1.0.2
@@ -159,7 +174,10 @@ jobs:
159174
if: matrix.build == 'linux'
160175
uses: bpicode/github-action-fpm@master
161176
with:
162-
fpm_args: "defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}=/usr/bin/defguard-proxy defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service example-config.toml=/etc/defguard/proxy.toml"
177+
fpm_args:
178+
"defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}=/usr/bin/defguard-proxy
179+
defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
180+
example-config.toml=/etc/defguard/proxy.toml"
163181
fpm_opts: "--architecture ${{ matrix.arch }} --debug --output-type deb --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb"
164182

165183
- name: Upload DEB
@@ -177,7 +195,10 @@ jobs:
177195
if: matrix.build == 'linux'
178196
uses: bpicode/github-action-fpm@master
179197
with:
180-
fpm_args: "defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}=/usr/bin/defguard-proxy defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service example-config.toml=/etc/defguard/proxy.toml"
198+
fpm_args:
199+
"defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}=/usr/bin/defguard-proxy
200+
defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
201+
example-config.toml=/etc/defguard/proxy.toml"
181202
fpm_opts: "--architecture ${{ matrix.arch }} --debug --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm"
182203

183204
- name: Upload RPM
@@ -190,3 +211,24 @@ jobs:
190211
asset_path: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
191212
asset_name: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
192213
asset_content_type: application/octet-stream
214+
215+
- name: Build FreeBSD package
216+
if: matrix.build == 'freebsd'
217+
uses: bpicode/github-action-fpm@master
218+
with:
219+
fpm_args:
220+
"defguard-${{ github.ref_name }}-${{ matrix.target }}=/usr/local/bin/defguard-proxy
221+
defguard-proxy.service.freebsd=/usr/local/etc/rc.d/defguard-proxy
222+
example-config.toml=/etc/defguard/proxy.toml"
223+
fpm_opts: "--architecture ${{ matrix.arch }} --debug --output-type freebsd --version ${{ env.VERSION }} --package defguard-${{ env.VERSION }}_${{ matrix.target }}.pkg --freebsd-osversion '*' --depends openssl"
224+
225+
- name: Upload FreeBSD
226+
if: matrix.build == 'freebsd'
227+
uses: actions/upload-release-asset@v1.0.2
228+
env:
229+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
230+
with:
231+
upload_url: ${{ needs.create-release.outputs.upload_url }}
232+
asset_path: defguard-${{ env.VERSION }}_${{ matrix.target }}.pkg
233+
asset_name: defguard-${{ env.VERSION }}_${{ matrix.target }}.pkg
234+
asset_content_type: application/octet-stream

defguard-proxy.service.freebsd

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/sh
2+
3+
# PROVIDE: defguard-proxy
4+
# REQUIRE: NETWORKING wireguard
5+
# KEYWORD: shutdown
6+
7+
. /etc/rc.subr
8+
9+
name="defguard"
10+
rcvar=defguard_enable
11+
command="/usr/local/bin/defguard-proxy"
12+
config="/etc/defguard/proxy.toml"
13+
start_cmd="${name}_start"
14+
15+
defguard_start()
16+
{
17+
${command} --config ${config} &
18+
}
19+
20+
load_rc_config $name
21+
run_rc_command "$1"

example-config.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# This is an example config file for defguard proxy
2-
# To use it fill in actual values for your deployment below
1+
# This is an example config file for Defguard Edge.
2+
# To use it, fill in actual values for your deployment below.
33

44
# port the API server will listen on
55
http_port = 8080

0 commit comments

Comments
 (0)