-
Notifications
You must be signed in to change notification settings - Fork 166
/
release_master.ps1
36 lines (30 loc) · 1.01 KB
/
release_master.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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