Skip to content

Bump wireguard-rs (#325) #197

Bump wireguard-rs (#325)

Bump wireguard-rs (#325) #197

Workflow file for this run

name: Publish
on:
push:
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 by publish-docker-latest.yml.
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
create-sbom:
needs:
- create-release
- build-docker-release
uses: ./.github/workflows/sbom.yml
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
build-release:
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=$VERSION" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
- 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-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@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@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@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@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@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"
fpm_opts:
"--architecture amd64
--output-type freebsd
--version ${{ env.VERSION }}
--package defguard-gateway-${{ env.VERSION }}_x86_64-unknown-freebsd.pkg
--freebsd-osversion '*'
--depends openssl"
- name: Build OPNsense package
uses: defGuard/fpm-action@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
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"
- 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-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@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@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@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@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@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@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@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@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