Skip to content

Commit

Permalink
fix version detection (#124)
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Kolberg <[email protected]>
  • Loading branch information
amdprophet authored Nov 8, 2024
1 parent cf3b879 commit a1dc9c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/_reusable_build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion utils/detect_version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit a1dc9c0

Please sign in to comment.