Fix release break due to CMakeList.txt dependency on description containing 3+ parts (which doesn't happen on first build with specified tag)

Also added release_master script to automate creating release forks from master as part of release process.
This commit is contained in:
Phil Smith 2017-10-27 15:05:33 -07:00
Родитель 3727c250cd
Коммит 10959a28e8
3 изменённых файлов: 46 добавлений и 1 удалений

Просмотреть файл

@ -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

1
release_master.cmd Normal file
Просмотреть файл

@ -0,0 +1 @@
powershell -File release_master.ps1

36
release_master.ps1 Normal file
Просмотреть файл

@ -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