From 9ef74fbb812314cc3473e509032c9fa843d3cba4 Mon Sep 17 00:00:00 2001 From: Timur Aitov Date: Thu, 18 Jan 2024 15:32:53 +0300 Subject: [PATCH] ci: build debian packages on push release tag --- .github/workflows/release.yml | 83 +++++++++++++++++++++++++++++++++++ debian/control | 8 ++++ 2 files changed, 91 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 debian/control diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..fb688d60 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,83 @@ +name: Release + +on: + push: + tags: + - 'v[0-9]+.[0-9]+' + +jobs: + build-debian-package-ubuntu22.04: + name: build (Ubuntu 22.04) + runs-on: builder + container: + image: yanetplatform/builder + steps: + - uses: actions/checkout@v3 + - run: | + export YANET_VERSION=${{github.ref_name}} + export YANET_VERSION=${YANET_VERSION:1} + export YANET_VERSION_MAJOR=${YANET_VERSION%.*} + export YANET_VERSION_MINOR=${YANET_VERSION#*.} + export YANET_VERSION_REVISION=${{github.run_number}} + export YANET_VERSION_HASH=${{github.sha}} + export YANET_VERSION_CUSTOM=stable + meson setup --prefix=/target \ + -Dtarget=release \ + -Dyanet_config=release,l3balancer,firewall \ + -Darch=corei7,broadwell,knl \ + -Dversion_major=$YANET_VERSION_MAJOR \ + -Dversion_minor=$YANET_VERSION_MINOR \ + -Dversion_revision=$YANET_VERSION_REVISION \ + -Dversion_hash=$YANET_VERSION_HASH \ + -Dversion_custom=$YANET_VERSION_CUSTOM \ + build + meson compile -C build + - run: meson install -C build + - run: | + cp -r debian /target/DEBIAN + sed -i "s/__VERSION__/${YANET_VERSION}/g" /target/DEBIAN/control + - run: | + mkdir /export + dpkg-deb -b "/target" /export/yanet_${YANET_VERSION}_ubuntu22.04.deb + - uses: actions/upload-artifact@v3 + with: + name: target_debian + path: /export/yanet*.deb + + build-debian-package-ubuntu18.04: + name: build (Ubuntu 18.04) + runs-on: builder + container: + image: yanetplatform/builder_ubuntu18.04 + steps: + - uses: actions/checkout@v3 + - run: | + export YANET_VERSION=${{github.ref_name}} + export YANET_VERSION=${YANET_VERSION:1} + export YANET_VERSION_MAJOR=${YANET_VERSION%.*} + export YANET_VERSION_MINOR=${YANET_VERSION#*.} + export YANET_VERSION_REVISION=${{github.run_number}} + export YANET_VERSION_HASH=${{github.sha}} + export YANET_VERSION_CUSTOM=stable + meson setup --prefix=/target \ + -Dtarget=release \ + -Dyanet_config=release,l3balancer,firewall \ + -Darch=corei7,broadwell,knl \ + -Dversion_major=$YANET_VERSION_MAJOR \ + -Dversion_minor=$YANET_VERSION_MINOR \ + -Dversion_revision=$YANET_VERSION_REVISION \ + -Dversion_hash=$YANET_VERSION_HASH \ + -Dversion_custom=$YANET_VERSION_CUSTOM \ + build + meson compile -C build + - run: meson install -C build + - run: | + cp -r debian /target/DEBIAN + sed -i "s/__VERSION__/${YANET_VERSION}/g" /target/DEBIAN/control + - run: | + mkdir /export + dpkg-deb -b "/target" /export/yanet_${YANET_VERSION}_ubuntu18.04.deb + - uses: actions/upload-artifact@v3 + with: + name: target_debian + path: /export/yanet*.deb diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..748752bc --- /dev/null +++ b/debian/control @@ -0,0 +1,8 @@ +Package: yanet +Version: __VERSION__ +Architecture: amd64 +Section: net +Maintainer: Timur Aitov +Homepage: https://github.com/yanet-platform/yanet +Description: Software forwarding traffic based on DPDK + YANET is an open-source extensible framework for software forwarding traffic based on DPDK