From a1dc9c055ac68212ce9cea91a81a4b26998f8cca Mon Sep 17 00:00:00 2001 From: Justin Kolberg Date: Fri, 8 Nov 2024 08:58:11 -0800 Subject: [PATCH] fix version detection (#124) Signed-off-by: Justin Kolberg --- .github/workflows/_reusable_build_package.yml | 9 +++++---- utils/detect_version.cmake | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/_reusable_build_package.yml b/.github/workflows/_reusable_build_package.yml index d3ad4eff..df4a31b1 100644 --- a/.github/workflows/_reusable_build_package.yml +++ b/.github/workflows/_reusable_build_package.yml @@ -143,10 +143,11 @@ jobs: id: get-otc-version if: inputs.cmake_target == 'otc_linux_amd64_deb' working-directory: build/version_detection - run: | + run: > version=$(./otelcol-sumo --version | - sed -E -n 's/.* v([0-9]+\.[0-9]+\.[0-9]+)\-sumo.*/\1/p') && - echo otc_version="${version}" >> $GITHUB_OUTPUT + sed -E -n 's/.* ([0-9]+\.[0-9]+\.[0-9]+)\-sumo.*/\1/p') && + echo otc_version="${version}" >> $GITHUB_OUTPUT && + if [[ "$version" == "" ]]; then exit 1; fi - name: Build Makefile id: cmake-linux @@ -279,7 +280,7 @@ jobs: working-directory: ./build/version_detection run: > version=$(./otelcol-sumo.exe --version | - sed -E -n 's/.* v([0-9]+\.[0-9]+\.[0-9]+)\-sumo.*/\1/p') && + sed -E -n 's/.* ([0-9]+\.[0-9]+\.[0-9]+)\-sumo.*/\1/p') && echo product_version="${version}.${{ inputs.otc_build_number }}" >> $GITHUB_OUTPUT && echo version="${version}-${{ inputs.otc_build_number }}" >> $GITHUB_OUTPUT diff --git a/utils/detect_version.cmake b/utils/detect_version.cmake index 68f1c4aa..400cadf1 100644 --- a/utils/detect_version.cmake +++ b/utils/detect_version.cmake @@ -16,7 +16,7 @@ function(detect_version _artifact_bin _working_dir) message(STATUS "Version output: ${_version_output}") - string(REGEX MATCH ".* v([0-9]+\.[0-9]+\.[0-9]+)\-sumo\-([0-9]+)\-.*" _ ${_version_output}) + string(REGEX MATCH ".* ([0-9]+\.[0-9]+\.[0-9]+)\-sumo\-([0-9]+)\-.*" _ ${_version_output}) if(NOT CMAKE_MATCH_COUNT EQUAL 2) message(FATAL_ERROR "Could not parse version information from version output")