From eb48638545d28146610bca3025d31ad5cf232ce6 Mon Sep 17 00:00:00 2001 From: Georgy Kirichenko Date: Thu, 19 Sep 2024 15:28:19 +0300 Subject: [PATCH] Test version --- .github/workflows/release.yml | 14 ++++++++------ build/Dockerfile.image | 1 - common/version.h | 6 +++++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6abc23de..de677c83 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,12 +21,8 @@ jobs: - name: version run: | export YANET_VERSION=${{github.ref_name}} - export YANET_VERSION=${YANET_VERSION} - 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 + export YANET_VERSION_MAJOR=$([[ ${YANET_VERSION} =~ ([0-9]*) ]] && echo ${BASH_REMATCH[1]}) + export YANET_VERSION_MINOR=$([[ ${YANET_VERSION} =~ [0-9]*.([0-9]*) ]] && echo ${BASH_REMATCH[1]}) - name: Docker meta id: meta uses: docker/metadata-action@v5 @@ -43,6 +39,12 @@ jobs: with: context: . file: ./build/Dockerfile.image + build-args: | + YANET_VERSION_MAJOR=${YANET_VERSION_MAJOR} + YANET_VERSION_MINOR=${YANET_VERSION_MINOR} + YANET_VERSION_REVISION=${{github.run_number}} + YANET_VERSION_HASH=${{github.sha}} + YANET_VERSION_CUSTOM=stable push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} diff --git a/build/Dockerfile.image b/build/Dockerfile.image index 2380b47a..446e31fd 100644 --- a/build/Dockerfile.image +++ b/build/Dockerfile.image @@ -28,7 +28,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ RUN python3 -m pip install meson==0.61.2 - FROM environment AS builder ARG YANET_VERSION_MAJOR=0 diff --git a/common/version.h b/common/version.h index 59134a3f..35064173 100644 --- a/common/version.h +++ b/common/version.h @@ -59,7 +59,11 @@ inline std::string version_custom() inline std::string version_to_string(const unsigned int major = YANET_VERSION_MAJOR, const unsigned int minor = YANET_VERSION_MINOR) { - std::string version(std::to_string(major) + "." + std::to_string(minor)); + std::string version(std::to_string(major) + "." + std::to_string(minor & 0xffff)); + if (minor & 0xffff0000) + { + version += "." + std::to_string(minor >> 16); + } return version; }