ci: fix version extraction, grep -oP unsupported on Alpine/BusyBox

The gitea-pages workflow runs in the alpine-jupyterbook container,
whose grep lacks PCRE (-P) support, so the version-extraction step
failed. Use a portable awk field scan instead, and fail loudly if
the version can't be found.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-26 13:56:19 +02:00
co-authored by Claude Sonnet 5
parent 8411e6ee16
commit bf30f358b5
+5 -1
View File
@@ -22,7 +22,11 @@ jobs:
- name: Extract project version from CMakeLists.txt
run: |
VERSION=$(grep -oP 'project\(\s*musrfit\s+VERSION\s+\K[0-9]+\.[0-9]+\.[0-9]+' CMakeLists.txt)
VERSION=$(awk '/project\(musrfit/{for(i=1;i<=NF;i++) if($i=="VERSION"){print $(i+1); exit}}' CMakeLists.txt)
if [ -z "$VERSION" ]; then
echo "Could not extract musrfit version from CMakeLists.txt" >&2
exit 1
fi
echo "MUSRFIT_VERSION=$VERSION" >> $GITHUB_ENV
- name: Build musrfit-tech-docu