Skip to content

Commit 4dfe740

Browse files
fix: fix extension semantic tag
In Slicer CI, the git repository is not initialized and querying the tag version fails with error code 128. fatal: not a git repository (or any of the parent directories): .git This fix makes semantic release update the CMake variable value directly.
1 parent 77aad48 commit 4dfe740

2 files changed

Lines changed: 6 additions & 19 deletions

File tree

.semantic-release

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[semantic_release]
2+
version_variables =
3+
extension.cmake:LayerDM_VERSION

extension.cmake

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,10 @@ find_package(Slicer REQUIRED)
1313
include(${Slicer_USE_FILE})
1414

1515
#-----------------------------------------------------------------------------
16-
# Extension version
17-
find_program(GIT_EXECUTABLE NAMES git REQUIRED)
18-
execute_process(
19-
COMMAND "${GIT_EXECUTABLE}" "describe" "--tags" "--abbrev=0" "--match" "v[0-9]*"
20-
RESULT_VARIABLE git_code
21-
OUTPUT_VARIABLE git_stdout
22-
ERROR_VARIABLE git_stderr
23-
)
16+
# Extension version (auto updated by semantic version)
17+
set(LayerDM_VERSION "0.0.0")
2418

25-
if(NOT git_code EQUAL 0)
26-
message(FATAL_ERROR "Failed to determined project version using Git.\n"
27-
"GIT_EXECUTABLE: ${GIT_EXECUTABLE}\n"
28-
"Return Code: ${git_code}\n"
29-
"Standard error:\n${git_stdout}\n"
30-
"Standard error:\n${git_stderr}\n"
31-
)
32-
endif()
33-
34-
string(STRIP "${git_stdout}" git_stdout) # git output will end with a newline
35-
string(SUBSTRING "${git_stdout}" 1 -1 LayerDM_VERSION) # remove first character
19+
string(SUBSTRING "${LayerDM_VERSION}" 1 -1 LayerDM_VERSION) # remove first character
3620
string(REPLACE "." ";" version_components "${LayerDM_VERSION}") # this creates a list
3721
list(GET version_components 0 LayerDM_VERSION_MAJOR)
3822
list(GET version_components 1 LayerDM_VERSION_MINOR)

0 commit comments

Comments
 (0)