Skip to content

Commit

Permalink
Test version
Browse files Browse the repository at this point in the history
  • Loading branch information
Georgy Kirichenko authored and GeorgyKirichenko committed Sep 19, 2024
1 parent b6e8635 commit 7acd563
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
26 changes: 17 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ on:
- 'release/*'

jobs:
version:
runs-on: ubuntu-latest
outputs:
major: ${{ steps.major.outputs.test }}
minor: ${{ steps.minor.outputs.test }}
steps:
- id: major
run: echo "$([[ ${{github.ref_name}} =~ ([0-9]*) ]] && echo ${BASH_REMATCH[1]})" >> "$GITHUB_OUTPUT"
- id: minor
run: echo "$([[ ${{github.ref_name}} =~ [0-9]*.([0-9]*) ]] && echo ${BASH_REMATCH[1]})" >> "$GITHUB_OUTPUT"
build-debian-package-jammy:
name: build-image
runs-on: ubuntu-latest
Expand All @@ -18,15 +28,6 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive
- 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
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
Expand All @@ -39,10 +40,17 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
id: push
needs: [version]
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
context: .
file: ./build/Dockerfile.image
build-args: |
YANET_VERSION_MAJOR=${{needs.version.outputs.major}}
YANET_VERSION_MINOR=${{needs.version.outputs.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 }}
1 change: 0 additions & 1 deletion build/Dockerfile.image
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion common/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 7acd563

Please sign in to comment.