Skip to content

Commit b8032a5

Browse files
committed
Improve release target
1 parent 7dce612 commit b8032a5

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,14 @@ add_custom_target(package DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${PACKAGE_NAME}")
5555
# create a release (by pushing a tag to the repository)
5656

5757
find_program(GIT git REQUIRED)
58+
find_program(GREP grep REQUIRED)
5859

5960
add_custom_target(
6061
release
6162
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
63+
COMMAND "${GIT}" diff-index --quiet HEAD -- # check for uncommitted changes
64+
COMMAND "${GIT}" branch --show-current | "${GREP}" -qx main # check for main branch
65+
COMMAND "${GIT}" cherry -v origin/main | "${GREP}" grep -q '^' # check for unpushed commits
6266
COMMAND "${GIT}" tag "v${CMAKE_PROJECT_VERSION}"
6367
COMMAND "${GIT}" push "v${CMAKE_PROJECT_VERSION}")
6468

0 commit comments

Comments
 (0)