Skip to content

Commit e48d402

Browse files
committed
Improve version bumping script
1 parent f6a2456 commit e48d402

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmake/bump_version.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ if(NOT EXISTS "${CMAKE_SOURCE_DIR}/cmake/cmkr.cmake")
1212
message(FATAL_ERROR "Cannot find cmkr.cmake")
1313
endif()
1414

15+
# Validate branch
16+
find_package(Git REQUIRED)
17+
execute_process(COMMAND "${GIT_EXECUTABLE}" branch --show-current OUTPUT_VARIABLE GIT_BRANCH)
18+
string(STRIP "${GIT_BRANCH}" GIT_BRANCH)
19+
if(NOT GIT_BRANCH STREQUAL "main")
20+
message(FATAL_ERROR "You need to be on the main branch, you are on: ${GIT_BRANCH}")
21+
endif()
22+
1523
file(READ "${CMAKE_SOURCE_DIR}/cmake.toml" CMAKE_TOML)
1624
string(FIND "${CMAKE_TOML}" "[project]" PROJECT_INDEX)
1725
string(SUBSTRING "${CMAKE_TOML}" ${PROJECT_INDEX} -1 CMAKE_TOML_PROJECT)

0 commit comments

Comments
 (0)