Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,19 +157,32 @@ jobs:
with:
configurePreset: ALL
buildPreset: ALL

- name: Extract version from CMake
id: get_version
shell: bash
shell: pwsh
run: |
if [ "${{ steps.check-cpp.outputs.skip }}" == "true" ]; then
if ("${{ steps.check-cpp.outputs.skip }}" -eq "true") {
# When skipping build, extract version from CMakeLists.txt
VERSION=$(grep 'project(.*VERSION' CMakeLists.txt | sed -E 's/.*VERSION ([0-9]+\.[0-9]+\.[0-9]+).*/\1/')
else
$content = Get-Content CMakeLists.txt -Raw
if ($content -match 'project\s*\(\s*\w+\s+VERSION\s+([0-9]+\.[0-9]+\.[0-9]+)') {
$version = $matches[1]
} else {
Write-Error "Version extraction failed: VERSION pattern not found in CMakeLists.txt" -ErrorAction Stop
}
} else {
# When building, extract version from CMakeCache.txt
VERSION=$(grep 'CMAKE_PROJECT_VERSION:STATIC' build/ALL/CMakeCache.txt | cut -d= -f2)
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
$content = Get-Content build/ALL/CMakeCache.txt
$versionLine = $content | Select-String -Pattern 'CMAKE_PROJECT_VERSION:STATIC'
if ($versionLine) {
$version = ($versionLine -replace '.*=([0-9]+\.[0-9]+\.[0-9]+).*', '$1').ToString()
} else {
Write-Error "Version extraction failed: CMAKE_PROJECT_VERSION not found in CMakeCache.txt" -ErrorAction Stop
}
}
if (-not $version -or $version -eq "") {
Write-Error "Version extraction failed: no version found" -ErrorAction Stop
}
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append

- name: Upload dist artifacts
if: success() && steps.check-cpp.outputs.skip != 'true'
Expand Down
Loading
Loading