From 21be2c45350abc6cb5c840301bfeac50f1a593eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Fri, 24 Jul 2026 09:49:21 +0200 Subject: [PATCH 1/7] Build source archive --- .github/workflows/release.yml | 627 +++++++++++++++++----------------- 1 file changed, 322 insertions(+), 305 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0294bb8c..e68541b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,8 @@ name: Publish on: push: + branches: + - source_release tags: - v*.*.* @@ -8,8 +10,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true - - jobs: build-docker-release: # Ignore tags with -, like v1.0.0-alpha @@ -52,6 +52,8 @@ jobs: with: draft: true generate_release_notes: true + release_name: v2.0.3 + tag_name: v2.0.3 create-sbom: needs: @@ -79,320 +81,335 @@ jobs: run: | VERSION=${GITHUB_REF_NAME#v} echo Version: $VERSION - echo "VERSION=$VERSION" >> $GITHUB_ENV + # echo "VERSION=$VERSION" >> $GITHUB_ENV + echo "VERSION=2.0.3" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: submodules: recursive - - name: Install Rust stable - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - with: - targets: "aarch64-unknown-linux-gnu" - - - name: Run sccache-cache - uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 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-gateway defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu - tar -zcf defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz \ - defguard-gateway-${{ 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-gateway defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu - tar -zcf defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz \ - defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu - - - name: Build FreeBSD binary - run: | - rsync -rlptxzH -e 'ssh -l root' --del ./ freebsd:work/gateway/ - ssh root@freebsd 'cd work/gateway && cargo build --locked --release' - scp root@freebsd:work/gateway/target/release/defguard-gateway defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd - tar -zcf defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd.tar.gz \ - defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd - - - name: Build x86_64 DEB package - uses: defGuard/fpm-action@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - with: - fpm_args: - "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-gateway - linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service - example-config.toml=/etc/defguard/gateway.toml" - fpm_opts: - "--architecture amd64 - --output-type deb - --version ${{ env.VERSION }} - --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - with: - fpm_args: - "defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-gateway - linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service - example-config.toml=/etc/defguard/gateway.toml" - fpm_opts: - "--architecture arm64 - --output-type deb - --version ${{ env.VERSION }} - --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - with: - fpm_args: - "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-gateway - linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service - example-config.toml=/etc/defguard/gateway.toml" - fpm_opts: - "--architecture amd64 - --output-type rpm - --version ${{ env.VERSION }} - --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - with: - fpm_args: - "defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-gateway - linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service - example-config.toml=/etc/defguard/gateway.toml" - fpm_opts: - "--architecture arm64 - --output-type rpm - --version ${{ env.VERSION }} - --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - with: - fpm_args: - "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-gateway - freebsd/defguard_gateway=/usr/local/etc/rc.d/defguard_gateway - example-config.toml=/etc/defguard/gateway.toml.sample" - fpm_opts: - "--architecture amd64 - --output-type freebsd - --version ${{ env.VERSION }} - --package defguard-gateway-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg - --freebsd-osversion '*' - --depends openssl - --after-install freebsd/post-install.sh" - - - name: Build OPNsense package - uses: defGuard/fpm-action@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - with: - fpm_args: - "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-gateway - freebsd/defguard_gateway=/usr/local/etc/rc.d/defguard_gateway - example-config.toml=/etc/defguard/gateway.toml.sample - freebsd/defguard-rc.conf=/etc/rc.conf.d/defguard_gateway - opnsense/src/etc/=/usr/local/etc/ - opnsense/src/opnsense/=/usr/local/opnsense/" - fpm_opts: - "--architecture amd64 - --output-type freebsd - --version ${{ env.VERSION }} - --package defguard-gateway-${{ env.VERSION }}_x86_64-unknown-opnsense.pkg - --freebsd-osversion '*' - --depends openssl - --after-install freebsd/post-install.sh" - - - name: Upload Linux x86_64 archive - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu.rpm - asset_content_type: application/gzip - overwrite: true - - - name: Upload FreeBSD package - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg - asset_content_type: application/x-pkg - overwrite: true + - name: Build source code archive + run: tar --exclude='.github' --exclude-vcs --xform='s|^\./|gateway-${{ env.VERSION }}/|' \ + --xz -cf defguard-gateway-${{ env.VERSION }}.tar.xz . - - name: Upload OPNsense package + - name: Upload source code archive uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ env.VERSION }}_x86_64-unknown-opnsense.pkg - asset_content_type: application/x-pkg + asset_path: defguard-gateway-${{ env.VERSION }}.tar.xz + asset_content_type: application/x-xz overwrite: true - 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 - rust_target: aarch64-unknown-linux-gnu - - architecture: X64 - deb_arch: amd64 - rust_target: x86_64-unknown-linux-gnu - container: - image: ubuntu:22.04 - env: - DEBIAN_FRONTEND: noninteractive - HOME: /root - RUSTUP_HOME: /root/.rustup - CARGO_HOME: /root/.cargo - - steps: - - name: Install git - run: | - apt-get update - apt-get install -y git curl ca-certificates libatomic1 - git config --global --add safe.directory '*' - - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - with: - submodules: recursive - - - name: Write release version - run: | - VERSION=${GITHUB_REF_NAME#v} - echo Version: $VERSION - echo "VERSION=$VERSION" >> $GITHUB_ENV - - - name: Install Rust stable - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - - - name: Install build dependencies - run: | - apt-get install -y \ - build-essential pkg-config cmake \ - libssl-dev libmnl-dev libnftnl-dev \ - protobuf-compiler libprotobuf-dev \ - ruby ruby-dev rubygems rpm - gem install fpm --no-document - - - name: Build binary - run: | - cargo build --locked --release --target ${{ matrix.rust_target }} - - - name: Build DEB package (ubuntu-22-04-lts) - run: | - fpm \ - --output-type deb \ - --version "${{ env.VERSION }}" \ - --architecture ${{ matrix.deb_arch }} \ - --package defguard-gateway-${{ env.VERSION }}-${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb \ - --before-install linux/preinst \ - --after-install linux/postinst \ - --before-remove linux/prerm \ - --after-remove linux/postrm \ - "target/${{ matrix.rust_target }}/release/defguard-gateway=/usr/bin/defguard-gateway" \ - "linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service" \ - "example-config.toml=/etc/defguard/gateway.toml" - - - name: Upload ubuntu-22-04-lts DEB - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ env.VERSION }}-${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb - asset_content_type: application/gzip - overwrite: true + # - name: Install Rust stable + # uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + # with: + # targets: "aarch64-unknown-linux-gnu" + + # - name: Run sccache-cache + # uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 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-gateway defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu + # tar -zcf defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz \ + # defguard-gateway-${{ 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-gateway defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu + # tar -zcf defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz \ + # defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu + + # - name: Build FreeBSD binary + # run: | + # rsync -rlptxzH -e 'ssh -l root' --del ./ freebsd:work/gateway/ + # ssh root@freebsd 'cd work/gateway && cargo build --locked --release' + # scp root@freebsd:work/gateway/target/release/defguard-gateway defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd + # tar -zcf defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd.tar.gz \ + # defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd + + # - name: Build x86_64 DEB package + # uses: defGuard/fpm-action@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + # with: + # fpm_args: + # "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-gateway + # linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service + # example-config.toml=/etc/defguard/gateway.toml" + # fpm_opts: + # "--architecture amd64 + # --output-type deb + # --version ${{ env.VERSION }} + # --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + # with: + # fpm_args: + # "defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-gateway + # linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service + # example-config.toml=/etc/defguard/gateway.toml" + # fpm_opts: + # "--architecture arm64 + # --output-type deb + # --version ${{ env.VERSION }} + # --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + # with: + # fpm_args: + # "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-gateway + # linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service + # example-config.toml=/etc/defguard/gateway.toml" + # fpm_opts: + # "--architecture amd64 + # --output-type rpm + # --version ${{ env.VERSION }} + # --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + # with: + # fpm_args: + # "defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-gateway + # linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service + # example-config.toml=/etc/defguard/gateway.toml" + # fpm_opts: + # "--architecture arm64 + # --output-type rpm + # --version ${{ env.VERSION }} + # --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + # with: + # fpm_args: + # "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-gateway + # freebsd/defguard_gateway=/usr/local/etc/rc.d/defguard_gateway + # example-config.toml=/etc/defguard/gateway.toml.sample" + # fpm_opts: + # "--architecture amd64 + # --output-type freebsd + # --version ${{ env.VERSION }} + # --package defguard-gateway-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg + # --freebsd-osversion '*' + # --depends openssl + # --after-install freebsd/post-install.sh" + + # - name: Build OPNsense package + # uses: defGuard/fpm-action@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + # with: + # fpm_args: + # "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-gateway + # freebsd/defguard_gateway=/usr/local/etc/rc.d/defguard_gateway + # example-config.toml=/etc/defguard/gateway.toml.sample + # freebsd/defguard-rc.conf=/etc/rc.conf.d/defguard_gateway + # opnsense/src/etc/=/usr/local/etc/ + # opnsense/src/opnsense/=/usr/local/opnsense/" + # fpm_opts: + # "--architecture amd64 + # --output-type freebsd + # --version ${{ env.VERSION }} + # --package defguard-gateway-${{ env.VERSION }}_x86_64-unknown-opnsense.pkg + # --freebsd-osversion '*' + # --depends openssl + # --after-install freebsd/post-install.sh" + + # - name: Upload Linux x86_64 archive + # uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu.rpm + # asset_content_type: application/gzip + # overwrite: true + + # - name: Upload FreeBSD package + # uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg + # asset_content_type: application/x-pkg + # overwrite: true + + # - name: Upload OPNsense package + # uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ env.VERSION }}_x86_64-unknown-opnsense.pkg + # asset_content_type: application/x-pkg + # overwrite: true + + # 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 + # rust_target: aarch64-unknown-linux-gnu + # - architecture: X64 + # deb_arch: amd64 + # rust_target: x86_64-unknown-linux-gnu + # container: + # image: ubuntu:22.04 + # env: + # DEBIAN_FRONTEND: noninteractive + # HOME: /root + # RUSTUP_HOME: /root/.rustup + # CARGO_HOME: /root/.cargo + + # steps: + # - name: Install git + # run: | + # apt-get update + # apt-get install -y git curl ca-certificates libatomic1 + # git config --global --add safe.directory '*' + + # - name: Checkout + # uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + # with: + # submodules: recursive + + # - name: Write release version + # run: | + # VERSION=${GITHUB_REF_NAME#v} + # echo Version: $VERSION + # echo "VERSION=$VERSION" >> $GITHUB_ENV + + # - name: Install Rust stable + # uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + + # - name: Install build dependencies + # run: | + # apt-get install -y \ + # build-essential pkg-config cmake \ + # libssl-dev libmnl-dev libnftnl-dev \ + # protobuf-compiler libprotobuf-dev \ + # ruby ruby-dev rubygems rpm + # gem install fpm --no-document + + # - name: Build binary + # run: | + # cargo build --locked --release --target ${{ matrix.rust_target }} + + # - name: Build DEB package (ubuntu-22-04-lts) + # run: | + # fpm \ + # --output-type deb \ + # --version "${{ env.VERSION }}" \ + # --architecture ${{ matrix.deb_arch }} \ + # --package defguard-gateway-${{ env.VERSION }}-${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb \ + # --before-install linux/preinst \ + # --after-install linux/postinst \ + # --before-remove linux/prerm \ + # --after-remove linux/postrm \ + # "target/${{ matrix.rust_target }}/release/defguard-gateway=/usr/bin/defguard-gateway" \ + # "linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service" \ + # "example-config.toml=/etc/defguard/gateway.toml" + + # - name: Upload ubuntu-22-04-lts DEB + # uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ needs.create-release.outputs.upload_url }} + # asset_path: defguard-gateway-${{ env.VERSION }}-${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb + # asset_content_type: application/gzip + # overwrite: true From bf938a9a8543eed9f466519763e512b3e82d274f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Fri, 24 Jul 2026 09:53:02 +0200 Subject: [PATCH 2/7] use runner.temp --- .github/workflows/release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e68541b3..f8d081ad 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -52,8 +52,8 @@ jobs: with: draft: true generate_release_notes: true - release_name: v2.0.3 - tag_name: v2.0.3 + release_name: v2.0.3-src + tag_name: v2.0.3-src create-sbom: needs: @@ -91,7 +91,7 @@ jobs: - name: Build source code archive run: tar --exclude='.github' --exclude-vcs --xform='s|^\./|gateway-${{ env.VERSION }}/|' \ - --xz -cf defguard-gateway-${{ env.VERSION }}.tar.xz . + --xz -cf ${{ runner.temp }}/defguard-gateway-${{ env.VERSION }}.tar.xz . - name: Upload source code archive uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 @@ -99,7 +99,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} - asset_path: defguard-gateway-${{ env.VERSION }}.tar.xz + asset_path: ${{ runner.temp }}/defguard-gateway-${{ env.VERSION }}.tar.xz asset_content_type: application/x-xz overwrite: true From b8434bc73ec0cd70d70216a88f4b959685cccbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Fri, 24 Jul 2026 09:56:17 +0200 Subject: [PATCH 3/7] one line --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8d081ad..31118658 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -90,8 +90,7 @@ jobs: submodules: recursive - name: Build source code archive - run: tar --exclude='.github' --exclude-vcs --xform='s|^\./|gateway-${{ env.VERSION }}/|' \ - --xz -cf ${{ runner.temp }}/defguard-gateway-${{ env.VERSION }}.tar.xz . + run: tar --exclude='.github' --exclude-vcs --xform='s|^\./|gateway-${{ env.VERSION }}/|' --xz -cf ${{ runner.temp }}/defguard-gateway-${{ env.VERSION }}.tar.xz . - name: Upload source code archive uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 From b597218a2abd37ff02c9ce185d378efd734566b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Fri, 24 Jul 2026 09:59:13 +0200 Subject: [PATCH 4/7] Ready --- .github/workflows/release.yml | 628 +++++++++++++++++----------------- 1 file changed, 311 insertions(+), 317 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 31118658..53251233 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,8 +1,6 @@ name: Publish on: push: - branches: - - source_release tags: - v*.*.* @@ -52,8 +50,6 @@ jobs: with: draft: true generate_release_notes: true - release_name: v2.0.3-src - tag_name: v2.0.3-src create-sbom: needs: @@ -72,7 +68,6 @@ jobs: - X64 env: SQLX_OFFLINE: "1" - # sccache SCCACHE_GHA_ENABLED: "true" RUSTC_WRAPPER: "sccache" steps: @@ -81,8 +76,7 @@ jobs: run: | VERSION=${GITHUB_REF_NAME#v} echo Version: $VERSION - # echo "VERSION=$VERSION" >> $GITHUB_ENV - echo "VERSION=2.0.3" >> $GITHUB_ENV + echo "VERSION=$VERSION" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 @@ -102,313 +96,313 @@ jobs: asset_content_type: application/x-xz overwrite: true - # - name: Install Rust stable - # uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - # with: - # targets: "aarch64-unknown-linux-gnu" - - # - name: Run sccache-cache - # uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 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-gateway defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu - # tar -zcf defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz \ - # defguard-gateway-${{ 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-gateway defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu - # tar -zcf defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz \ - # defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu - - # - name: Build FreeBSD binary - # run: | - # rsync -rlptxzH -e 'ssh -l root' --del ./ freebsd:work/gateway/ - # ssh root@freebsd 'cd work/gateway && cargo build --locked --release' - # scp root@freebsd:work/gateway/target/release/defguard-gateway defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd - # tar -zcf defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd.tar.gz \ - # defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd - - # - name: Build x86_64 DEB package - # uses: defGuard/fpm-action@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - # with: - # fpm_args: - # "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-gateway - # linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service - # example-config.toml=/etc/defguard/gateway.toml" - # fpm_opts: - # "--architecture amd64 - # --output-type deb - # --version ${{ env.VERSION }} - # --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - # with: - # fpm_args: - # "defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-gateway - # linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service - # example-config.toml=/etc/defguard/gateway.toml" - # fpm_opts: - # "--architecture arm64 - # --output-type deb - # --version ${{ env.VERSION }} - # --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - # with: - # fpm_args: - # "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-gateway - # linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service - # example-config.toml=/etc/defguard/gateway.toml" - # fpm_opts: - # "--architecture amd64 - # --output-type rpm - # --version ${{ env.VERSION }} - # --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - # with: - # fpm_args: - # "defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-gateway - # linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service - # example-config.toml=/etc/defguard/gateway.toml" - # fpm_opts: - # "--architecture arm64 - # --output-type rpm - # --version ${{ env.VERSION }} - # --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - # with: - # fpm_args: - # "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-gateway - # freebsd/defguard_gateway=/usr/local/etc/rc.d/defguard_gateway - # example-config.toml=/etc/defguard/gateway.toml.sample" - # fpm_opts: - # "--architecture amd64 - # --output-type freebsd - # --version ${{ env.VERSION }} - # --package defguard-gateway-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg - # --freebsd-osversion '*' - # --depends openssl - # --after-install freebsd/post-install.sh" - - # - name: Build OPNsense package - # uses: defGuard/fpm-action@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main - # with: - # fpm_args: - # "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-gateway - # freebsd/defguard_gateway=/usr/local/etc/rc.d/defguard_gateway - # example-config.toml=/etc/defguard/gateway.toml.sample - # freebsd/defguard-rc.conf=/etc/rc.conf.d/defguard_gateway - # opnsense/src/etc/=/usr/local/etc/ - # opnsense/src/opnsense/=/usr/local/opnsense/" - # fpm_opts: - # "--architecture amd64 - # --output-type freebsd - # --version ${{ env.VERSION }} - # --package defguard-gateway-${{ env.VERSION }}_x86_64-unknown-opnsense.pkg - # --freebsd-osversion '*' - # --depends openssl - # --after-install freebsd/post-install.sh" - - # - name: Upload Linux x86_64 archive - # uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu.rpm - # asset_content_type: application/gzip - # overwrite: true - - # - name: Upload FreeBSD package - # uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg - # asset_content_type: application/x-pkg - # overwrite: true - - # - name: Upload OPNsense package - # uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ env.VERSION }}_x86_64-unknown-opnsense.pkg - # asset_content_type: application/x-pkg - # overwrite: true - - # 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 - # rust_target: aarch64-unknown-linux-gnu - # - architecture: X64 - # deb_arch: amd64 - # rust_target: x86_64-unknown-linux-gnu - # container: - # image: ubuntu:22.04 - # env: - # DEBIAN_FRONTEND: noninteractive - # HOME: /root - # RUSTUP_HOME: /root/.rustup - # CARGO_HOME: /root/.cargo - - # steps: - # - name: Install git - # run: | - # apt-get update - # apt-get install -y git curl ca-certificates libatomic1 - # git config --global --add safe.directory '*' - - # - name: Checkout - # uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 - # with: - # submodules: recursive - - # - name: Write release version - # run: | - # VERSION=${GITHUB_REF_NAME#v} - # echo Version: $VERSION - # echo "VERSION=$VERSION" >> $GITHUB_ENV - - # - name: Install Rust stable - # uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable - - # - name: Install build dependencies - # run: | - # apt-get install -y \ - # build-essential pkg-config cmake \ - # libssl-dev libmnl-dev libnftnl-dev \ - # protobuf-compiler libprotobuf-dev \ - # ruby ruby-dev rubygems rpm - # gem install fpm --no-document - - # - name: Build binary - # run: | - # cargo build --locked --release --target ${{ matrix.rust_target }} - - # - name: Build DEB package (ubuntu-22-04-lts) - # run: | - # fpm \ - # --output-type deb \ - # --version "${{ env.VERSION }}" \ - # --architecture ${{ matrix.deb_arch }} \ - # --package defguard-gateway-${{ env.VERSION }}-${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb \ - # --before-install linux/preinst \ - # --after-install linux/postinst \ - # --before-remove linux/prerm \ - # --after-remove linux/postrm \ - # "target/${{ matrix.rust_target }}/release/defguard-gateway=/usr/bin/defguard-gateway" \ - # "linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service" \ - # "example-config.toml=/etc/defguard/gateway.toml" - - # - name: Upload ubuntu-22-04-lts DEB - # uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # upload_url: ${{ needs.create-release.outputs.upload_url }} - # asset_path: defguard-gateway-${{ env.VERSION }}-${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb - # asset_content_type: application/gzip - # overwrite: true + - name: Install Rust stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + with: + targets: "aarch64-unknown-linux-gnu" + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@7d986dd989559c6ecdb630a3fd2557667be217ad # 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-gateway defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu + tar -zcf defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu.tar.gz \ + defguard-gateway-${{ 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-gateway defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu + tar -zcf defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu.tar.gz \ + defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu + + - name: Build FreeBSD binary + run: | + rsync -rlptxzH -e 'ssh -l root' --del ./ freebsd:work/gateway/ + ssh root@freebsd 'cd work/gateway && cargo build --locked --release' + scp root@freebsd:work/gateway/target/release/defguard-gateway defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd + tar -zcf defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd.tar.gz \ + defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd + + - name: Build x86_64 DEB package + uses: defGuard/fpm-action@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + with: + fpm_args: + "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-gateway + linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service + example-config.toml=/etc/defguard/gateway.toml" + fpm_opts: + "--architecture amd64 + --output-type deb + --version ${{ env.VERSION }} + --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + with: + fpm_args: + "defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-gateway + linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service + example-config.toml=/etc/defguard/gateway.toml" + fpm_opts: + "--architecture arm64 + --output-type deb + --version ${{ env.VERSION }} + --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + with: + fpm_args: + "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-linux-gnu=/usr/bin/defguard-gateway + linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service + example-config.toml=/etc/defguard/gateway.toml" + fpm_opts: + "--architecture amd64 + --output-type rpm + --version ${{ env.VERSION }} + --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + with: + fpm_args: + "defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu=/usr/bin/defguard-gateway + linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service + example-config.toml=/etc/defguard/gateway.toml" + fpm_opts: + "--architecture arm64 + --output-type rpm + --version ${{ env.VERSION }} + --package defguard-gateway-${{ 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@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + with: + fpm_args: + "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-gateway + freebsd/defguard_gateway=/usr/local/etc/rc.d/defguard_gateway + example-config.toml=/etc/defguard/gateway.toml.sample" + fpm_opts: + "--architecture amd64 + --output-type freebsd + --version ${{ env.VERSION }} + --package defguard-gateway-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg + --freebsd-osversion '*' + --depends openssl + --after-install freebsd/post-install.sh" + + - name: Build OPNsense package + uses: defGuard/fpm-action@ebb2575fbb892876fbdd326bb6d12524fbd7398c # main + with: + fpm_args: + "defguard-gateway-${{ env.VERSION }}-x86_64-unknown-freebsd=/usr/local/bin/defguard-gateway + freebsd/defguard_gateway=/usr/local/etc/rc.d/defguard_gateway + example-config.toml=/etc/defguard/gateway.toml.sample + freebsd/defguard-rc.conf=/etc/rc.conf.d/defguard_gateway + opnsense/src/etc/=/usr/local/etc/ + opnsense/src/opnsense/=/usr/local/opnsense/" + fpm_opts: + "--architecture amd64 + --output-type freebsd + --version ${{ env.VERSION }} + --package defguard-gateway-${{ env.VERSION }}_x86_64-unknown-opnsense.pkg + --freebsd-osversion '*' + --depends openssl + --after-install freebsd/post-install.sh" + + - name: Upload Linux x86_64 archive + uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ 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@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ env.VERSION }}-aarch64-unknown-linux-gnu.rpm + asset_content_type: application/gzip + overwrite: true + + - name: Upload FreeBSD package + uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg + asset_content_type: application/x-pkg + overwrite: true + + - name: Upload OPNsense package + uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ env.VERSION }}_x86_64-unknown-opnsense.pkg + asset_content_type: application/x-pkg + overwrite: true + + 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 + rust_target: aarch64-unknown-linux-gnu + - architecture: X64 + deb_arch: amd64 + rust_target: x86_64-unknown-linux-gnu + container: + image: ubuntu:22.04 + env: + DEBIAN_FRONTEND: noninteractive + HOME: /root + RUSTUP_HOME: /root/.rustup + CARGO_HOME: /root/.cargo + + steps: + - name: Install git + run: | + apt-get update + apt-get install -y git curl ca-certificates libatomic1 + git config --global --add safe.directory '*' + + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + submodules: recursive + + - name: Write release version + run: | + VERSION=${GITHUB_REF_NAME#v} + echo Version: $VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable + + - name: Install build dependencies + run: | + apt-get install -y \ + build-essential pkg-config cmake \ + libssl-dev libmnl-dev libnftnl-dev \ + protobuf-compiler libprotobuf-dev \ + ruby ruby-dev rubygems rpm + gem install fpm --no-document + + - name: Build binary + run: | + cargo build --locked --release --target ${{ matrix.rust_target }} + + - name: Build DEB package (ubuntu-22-04-lts) + run: | + fpm \ + --output-type deb \ + --version "${{ env.VERSION }}" \ + --architecture ${{ matrix.deb_arch }} \ + --package defguard-gateway-${{ env.VERSION }}-${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb \ + --before-install linux/preinst \ + --after-install linux/postinst \ + --before-remove linux/prerm \ + --after-remove linux/postrm \ + "target/${{ matrix.rust_target }}/release/defguard-gateway=/usr/bin/defguard-gateway" \ + "linux/defguard-gateway.service=/usr/lib/systemd/system/defguard-gateway.service" \ + "example-config.toml=/etc/defguard/gateway.toml" + + - name: Upload ubuntu-22-04-lts DEB + uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: defguard-gateway-${{ env.VERSION }}-${{ matrix.deb_arch }}_ubuntu-22-04-lts.deb + asset_content_type: application/gzip + overwrite: true From a734a7cb28f2066f7247fa1c6dc95ce9a5d80a99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Fri, 24 Jul 2026 10:26:07 +0200 Subject: [PATCH 5/7] Add --exclude-vcs-ignores --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 53251233..62aeefda 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,7 +84,7 @@ jobs: submodules: recursive - name: Build source code archive - run: tar --exclude='.github' --exclude-vcs --xform='s|^\./|gateway-${{ env.VERSION }}/|' --xz -cf ${{ runner.temp }}/defguard-gateway-${{ env.VERSION }}.tar.xz . + run: tar --exclude='.github' --exclude-vcs --exclude-vcs-ignores --xform='s|^\./|gateway-${{ env.VERSION }}/|' --xz -cf ${{ runner.temp }}/defguard-gateway-${{ env.VERSION }}.tar.xz . - name: Upload source code archive uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 From f4368f61c2e0e0fc4286d286e0e9b838e870cd25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Fri, 24 Jul 2026 10:34:46 +0200 Subject: [PATCH 6/7] Update shogo82148/actions-upload-release-asset --- .github/workflows/release.yml | 22 +++++++++++----------- .github/workflows/sbom.yml | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62aeefda..1c5b9222 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -87,7 +87,7 @@ jobs: run: tar --exclude='.github' --exclude-vcs --exclude-vcs-ignores --xform='s|^\./|gateway-${{ env.VERSION }}/|' --xz -cf ${{ runner.temp }}/defguard-gateway-${{ env.VERSION }}.tar.xz . - name: Upload source code archive - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -233,7 +233,7 @@ jobs: --after-install freebsd/post-install.sh" - name: Upload Linux x86_64 archive - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -243,7 +243,7 @@ jobs: overwrite: true - name: Upload Linux aarch64 archive - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -253,7 +253,7 @@ jobs: overwrite: true - name: Upload FreeBSD x86_64 archive - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -263,7 +263,7 @@ jobs: overwrite: true - name: Upload Linux x86_64 DEB - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -273,7 +273,7 @@ jobs: overwrite: true - name: Upload Linux aarch64 DEB - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -283,7 +283,7 @@ jobs: overwrite: true - name: Upload Linux x86_64 RPM - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -293,7 +293,7 @@ jobs: overwrite: true - name: Upload Linux aarch64 RPM - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -303,7 +303,7 @@ jobs: overwrite: true - name: Upload FreeBSD package - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -313,7 +313,7 @@ jobs: overwrite: true - name: Upload OPNsense package - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -398,7 +398,7 @@ jobs: "example-config.toml=/etc/defguard/gateway.toml" - name: Upload ubuntu-22-04-lts DEB - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: diff --git a/.github/workflows/sbom.yml b/.github/workflows/sbom.yml index 975d436b..9feecd82 100644 --- a/.github/workflows/sbom.yml +++ b/.github/workflows/sbom.yml @@ -85,7 +85,7 @@ jobs: scanners: "vuln" - name: Upload SBOMs and advisories - uses: shogo82148/actions-upload-release-asset@ee2ae851dc5d938b90075b3ef12c540abfd1ee72 # v1 + uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From f5e5c0a45e81c6ead4109562e9e0fb4088fdc8e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20Ciarcin=CC=81ski?= Date: Fri, 24 Jul 2026 10:39:16 +0200 Subject: [PATCH 7/7] cargo deny check --hide-inclusion-graph --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72191ad8..e75a9e69 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: tool: cargo-deny - name: Run cargo deny - run: cargo deny check + run: cargo deny check --hide-inclusion-graph - name: Run tests run: cargo test --locked --no-fail-fast