diff --git a/CMakeLists.txt b/CMakeLists.txt index 0620e6f6..83a1eb52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,8 +84,16 @@ IF(GIT_FOUND) SET(VERSION_MINOR ${CMAKE_MATCH_2}) SET(VERSION_PATCH ${CMAKE_MATCH_3}) + IF(${VERSION_MAJOR} STREQUAL "") + MESSAGE(STATUS "GIT Description is from NEW tag") + string(REGEX MATCH "v([0-9]+)\\.([0-9]+)" _dummy2 "${GIT_DESCRIPTION}") + SET(VERSION_MAJOR ${CMAKE_MATCH_1}) + SET(VERSION_MINOR ${CMAKE_MATCH_2}) + SET(VERSION_PATCH "0") + ENDIF() + IF(NOT ${GIT_REFSPEC}) - string(REGEX MATCH "refs/heads/([a-zA-Z0-9_/]+)" _dummy2 ${GIT_REFSPEC}) + string(REGEX MATCH "refs/heads/([a-zA-Z0-9_/]+)" _dummy3 ${GIT_REFSPEC}) SET(GIT_BRANCH_NAME ${CMAKE_MATCH_1}) ELSE() # VSO doesn't checkout a branch do a pull, it checks out a hash and does a pull diff --git a/release_master.cmd b/release_master.cmd new file mode 100644 index 00000000..7b9ade75 --- /dev/null +++ b/release_master.cmd @@ -0,0 +1 @@ +powershell -File release_master.ps1 diff --git a/release_master.ps1 b/release_master.ps1 new file mode 100644 index 00000000..92d97617 --- /dev/null +++ b/release_master.ps1 @@ -0,0 +1,36 @@ +$description = git describe; +Write-Host "description = '$description'" + +[regex]$rx = "v([0-9]+)\.([0-9]+)" +$matches = $rx.Match($description); +$major = $matches.Groups[1].ToString(); +$minor = $matches.Groups[2].ToString(); +Write-Host "major = " $major +Write-Host "minor = " $minor + +$oldTag = "v" + $major + "." + $minor +Write-Host "old tag = " $oldTag + +$minor = ([int]$minor+1).ToString(); +$newTag = "v" + $major + "." + $minor +Write-Host "new tag = " $newTag + +$versionText = "Version " + $major + "." + $minor; +Write-Host "Version Text = '$versionText'" + +$newBranch = "release_$newTag"; +Write-Host "new branch: '$newBranch'" + +Write-Host "Creating $newBranch" +git checkout -b $newBranch +Write-Host "Creating $newTag tag" +git tag -a $newTag -m "$versionText" +Write-Host "Pushing $newTag" +git push origin $newTag +Write-Host "Pushing $newBranch" +git push --set-upstream origin $newBranch +Write-Host "Pulling commit back to master" +git checkout master +git fetch +git pull origin $newBranch +git push