From 8fdc76d3905162a8655a87398d664e34f3dccb54 Mon Sep 17 00:00:00 2001 From: A1029384756 Date: Thu, 26 Mar 2026 20:28:14 -0400 Subject: [PATCH] [ci] fix odin versioning in nightly builds --- ci/build_linux_static.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ci/build_linux_static.sh b/ci/build_linux_static.sh index 2eb99116e..d88081f1e 100755 --- a/ci/build_linux_static.sh +++ b/ci/build_linux_static.sh @@ -6,7 +6,14 @@ LLVM_CONFIG="llvm-config-20" DISABLED_WARNINGS="-Wno-switch -Wno-macro-redefined -Wno-unused-value" -CPPFLAGS="-DODIN_VERSION_RAW=\"dev-$(date +"%Y-%m")\"" +if [ -d ".git" ] && [ -n "$(command -v git)" ]; then + GIT_SHA=$(git show --pretty='%h' --no-patch --no-notes HEAD) + GIT_DATE=$(git show "--pretty=%cd" "--date=format:%Y-%m" --no-patch --no-notes HEAD) + CPPFLAGS="$CPPFLAGS -DGIT_SHA=\"$GIT_SHA\"" +else + GIT_DATE=$(date +"%Y-%m") +fi +CPPFLAGS="$CPPFLAGS -DODIN_VERSION_RAW=\"dev-$GIT_DATE\"" CXXFLAGS="-std=c++14 $($LLVM_CONFIG --cxxflags --ldflags)" LDFLAGS="-static -lm -lzstd -lz -lffi -pthread -ldl -fuse-ld=mold"