@@ -64,19 +64,28 @@ jobs:
6464 name : test
6565
6666 create-sbom :
67- needs : [create-release, build-docker-release]
67+ needs :
68+ - create-release
69+ - build-docker-release
6870 uses : ./.github/workflows/sbom.yml
6971 with :
7072 upload_url : ${{ needs.create-release.outputs.upload_url }}
7173
72- build-web :
74+ build-binaries :
75+ needs :
76+ - create-release
7377 runs-on :
74- # - codebuild-defguard-proxy-runner-${{ github.run_id }}-${{ github.run_attempt }}
7578 - self-hosted
7679 - Linux
7780 - X64
78-
7981 steps :
82+ # Store the version, stripping any v-prefix
83+ - name : Write release version
84+ run : |
85+ VERSION=${GITHUB_REF_NAME#v}
86+ echo Version: $VERSION
87+ echo "VERSION=$VERSION" >> $GITHUB_ENV
88+
8089 - name : Checkout
8190 uses : actions/checkout@v6
8291 with :
@@ -99,149 +108,117 @@ jobs:
99108 run : pnpm install --ignore-scripts --no-frozen-lockfile && pnpm build
100109 working-directory : web
101110
102- build-binaries :
103- needs :
104- - build-web
105- - create-release
106- runs-on :
107- - self-hosted
108- - ${{ matrix.os }}
109- - X64
110- strategy :
111- fail-fast : false
112- matrix :
113- build : [linux, linux-arm64, freebsd]
114- include :
115- - build : linux
116- arch : amd64
117- os : Linux
118- target : x86_64-unknown-linux-gnu
119- - build : linux-arm64
120- arch : arm64
121- os : Linux
122- target : aarch64-unknown-linux-gnu
123- - build : freebsd
124- arch : amd64
125- os : Linux
126- target : x86_64-unknown-freebsd
127- steps :
128- # Store the version, stripping any v-prefix
129- - name : Write release version
130- run : |
131- VERSION=${GITHUB_REF_NAME#v}
132- echo Version: $VERSION
133- echo "VERSION=$VERSION" >> $GITHUB_ENV
134-
135- - name : Checkout
136- uses : actions/checkout@v6
137- with :
138- submodules : recursive
139-
140111 - name : Install Rust stable
141- if : matrix.build == 'linux'
142112 uses : dtolnay/rust-toolchain@stable
143113 with :
144114 targets : " aarch64-unknown-linux-gnu"
145115
146- - name : Setup `packer`
147- uses : hashicorp/setup-packer@main
148- id : setup
149-
150- - name : Build release binary
151- if : matrix.build == 'linux'
152- run : cargo build --locked --release --target ${{ matrix.target }}
116+ - name : Build Linux x86_64 binary
117+ run : |
118+ cargo build --locked --release --target x86_64-unknown-linux-gnu
119+ mv target/x86_64-unknown-linux-gnu/release/defguard-proxy defguard-proxy-${{ github.ref_name }}-x86_64-unknown-linux-gnu
120+ tar -zcf defguard-proxy-${{ github.ref_name }}-x86_64-unknown-linux-gnu.tar.gz \
121+ defguard-proxy-${{ github.ref_name }}-x86_64-unknown-linux-gnu
153122
154- - name : Cross-build release binary
155- if : matrix.build == 'linux-arm64'
123+ - name : Build Linux aarch64 binary
156124 env :
157125 CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER : aarch64-linux-gnu-gcc
158126 PKG_CONFIG_SYSROOT_DIR : /usr/lib/aarch64-linux-gnu
159- run : cargo build --locked --release --target ${{ matrix.target }}
127+ run : |
128+ cargo build --locked --release --target aarch64-unknown-linux-gnu
129+ mv target/aarch64-unknown-linux-gnu/release/defguard-proxy defguard-proxy-${{ github.ref_name }}-aarch64-unknown-linux-gnu
130+ tar -zcf defguard-proxy-${{ github.ref_name }}-aarch64-unknown-linux-gnu.tar.gz \
131+ defguard-proxy-${{ github.ref_name }}-aarch64-unknown-linux-gnu
160132
161- - name : Cross-build release binary
162- if : matrix.build == 'freebsd'
133+ - name : Build FreeBSD binary
163134 run : |
164135 rsync -rlptxzH -e 'ssh -l root' --del ./ freebsd:work/
165136 ssh root@freebsd 'cd work && cargo build --locked --release'
166- scp root@freebsd:work/target/release/defguard-proxy defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
167-
168- - name : Rename binary
169- run : mv target/${{ matrix.target }}/release/defguard-proxy defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
170-
171- - name : Tar
172- run :
173- tar -zcf defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz \
174- defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}
175-
176- - name : Upload release archive
177- uses : actions/upload-release-asset@v1.0.2
178- env :
179- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
180- with :
181- upload_url : ${{ needs.create-release.outputs.upload_url }}
182- asset_path : defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
183- asset_name : defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
184- asset_content_type : application/octet-stream
185-
186- - name : Build DEB package
187- if : matrix.build == 'linux'
137+ scp root@freebsd:work/target/release/defguard-proxy defguard-proxy-${{ github.ref_name }}-x86_64-unknown-freebsd
138+ tar -zcf defguard-proxy-${{ github.ref_name }}-x86_64-unknown-freebsd.tar.gz \
139+ defguard-proxy-${{ github.ref_name }}-x86_64-unknown-freebsd
140+
141+ # - name: Upload release archive
142+ # uses: actions/upload-release-asset@v1.0.2
143+ # env:
144+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
145+ # with:
146+ # upload_url: ${{ needs.create-release.outputs.upload_url }}
147+ # asset_path: defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
148+ # asset_name: defguard-proxy-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
149+ # asset_content_type: application/octet-stream
150+
151+ - name : Build x86_64 DEB package
188152 uses : bpicode/github-action-fpm@master
189153 with :
190154 fpm_args :
191- " defguard-proxy-${{ github.ref_name }}-${{ matrix.target }} =/usr/bin/defguard-proxy
155+ " defguard-proxy-${{ github.ref_name }}-x86_64-unknown-linux-gnu =/usr/bin/defguard-proxy
192156 defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
193157 example-config.toml=/etc/defguard/proxy.toml"
194- fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type deb --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-${{ matrix.target }} .deb"
158+ fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type deb --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu .deb"
195159
196- - name : Upload DEB
197- if : matrix.build == 'linux'
198- uses : actions/upload-release-asset@v1.0.2
199- env :
200- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
160+ - name : Build aarch64 DEB package
161+ uses : bpicode/github-action-fpm@master
201162 with :
202- upload_url : ${{ needs.create-release.outputs.upload_url }}
203- asset_path : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
204- asset_name : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.deb
205- asset_content_type : application/octet-stream
206-
207- - name : Build RPM package
208- if : matrix.build == 'linux'
163+ fpm_args :
164+ " defguard-proxy-${{ github.ref_name }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-proxy
165+ defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
166+ example-config.toml=/etc/defguard/proxy.toml"
167+ fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type deb --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-aarch64-unknown-linux-gnu.deb"
168+
169+ # - name: Upload DEB
170+ # uses: actions/upload-release-asset@v1.0.2
171+ # env:
172+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
173+ # with:
174+ # upload_url: ${{ needs.create-release.outputs.upload_url }}
175+ # asset_path: defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb
176+ # asset_name: defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu.deb
177+ # asset_content_type: application/octet-stream
178+
179+ - name : Build x86_64 RPM package
209180 uses : bpicode/github-action-fpm@master
210181 with :
211182 fpm_args :
212- " defguard-proxy-${{ github.ref_name }}-${{ matrix.target }} =/usr/bin/defguard-proxy
183+ " defguard-proxy-${{ github.ref_name }}-x86_64-unknown-linux-gnu =/usr/bin/defguard-proxy
213184 defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
214185 example-config.toml=/etc/defguard/proxy.toml"
215- fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-${{ matrix.target }} .rpm"
186+ fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-x86_64-unknown-linux-gnu .rpm"
216187
217- - name : Upload RPM
218- if : matrix.build == 'linux'
219- uses : actions/upload-release-asset@v1.0.2
220- env :
221- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
188+ - name : Build aarch64 RPM package
189+ uses : bpicode/github-action-fpm@master
222190 with :
223- upload_url : ${{ needs.create-release.outputs.upload_url }}
224- asset_path : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
225- asset_name : defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
226- asset_content_type : application/octet-stream
191+ fpm_args :
192+ " defguard-proxy-${{ github.ref_name }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-proxy
193+ defguard-proxy.service=/usr/lib/systemd/system/defguard-proxy.service
194+ example-config.toml=/etc/defguard/proxy.toml"
195+ fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type rpm --version ${{ env.VERSION }} --package defguard-proxy-${{ env.VERSION }}-aarch64-unknown-freebsd.rpm"
196+
197+ # - name: Upload RPM
198+ # uses: actions/upload-release-asset@v1.0.2
199+ # env:
200+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
201+ # with:
202+ # upload_url: ${{ needs.create-release.outputs.upload_url }}
203+ # asset_path: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
204+ # asset_name: defguard-proxy-${{ env.VERSION }}-${{ matrix.target }}.rpm
205+ # asset_content_type: application/octet-stream
227206
228207 - name : Build FreeBSD package
229- if : matrix.build == 'freebsd'
230208 uses : bpicode/github-action-fpm@master
231209 with :
232210 fpm_args :
233- " defguard-${{ github.ref_name }}-${{ matrix.target }} =/usr/local/bin/defguard-proxy
211+ " defguard-${{ github.ref_name }}-x86_64-unknown-freebsd =/usr/local/bin/defguard-proxy
234212 defguard-proxy.service.freebsd=/usr/local/etc/rc.d/defguard-proxy
235213 example-config.toml=/etc/defguard/proxy.toml"
236- fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type freebsd --version ${{ env.VERSION }} --package defguard-${{ env.VERSION }}_${{ matrix.target }}.pkg --freebsd-osversion '*' --depends openssl"
237-
238- - name : Upload FreeBSD
239- if : matrix.build == 'freebsd'
240- uses : actions/upload-release-asset@v1.0.2
241- env :
242- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
243- with :
244- upload_url : ${{ needs.create-release.outputs.upload_url }}
245- asset_path : defguard-${{ env.VERSION }}_${{ matrix.target }}.pkg
246- asset_name : defguard-${{ env.VERSION }}_${{ matrix.target }}.pkg
247- asset_content_type : application/octet-stream
214+ fpm_opts : " --architecture ${{ matrix.arch }} --debug --output-type freebsd --version ${{ env.VERSION }} --package defguard-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg --freebsd-osversion '*' --depends openssl"
215+
216+ # - name: Upload FreeBSD
217+ # uses: actions/upload-release-asset@v1.0.2
218+ # env:
219+ # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220+ # with:
221+ # upload_url: ${{ needs.create-release.outputs.upload_url }}
222+ # asset_path: defguard-${{ env.VERSION }}_${{ matrix.target }}.pkg
223+ # asset_name: defguard-${{ env.VERSION }}_${{ matrix.target }}.pkg
224+ # asset_content_type: application/octet-stream
0 commit comments