-
Notifications
You must be signed in to change notification settings - Fork 12
/
_publish-release.ps1
27 lines (22 loc) · 1.02 KB
/
_publish-release.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
Push-Location $PSScriptRoot
clear
# Getting current version
[xml]$parsedCsproj = Get-Content .\BattleNetPrefill\BattleNetPrefill.csproj
$versionPrefix = $parsedCsproj.Project.PropertyGroup.VersionPrefix
$currentVersion = "$versionPrefix".Trim();
Write-Color "Current version: ", $currentVersion -Color White, Yellow
# Getting new version to use
$newVersion = Read-Host "Enter new version, with no leading 'v'. Ex. '1.2.3'"
if($newVersion.Contains("v"))
{
Write-Color $newVersion, " is not a valid version since it has a leading 'v'." -Color Yellow, Red
}
# Updating csproj version
$currentContent = Get-Content -Path .\BattleNetPrefill\BattleNetPrefill.csproj -Raw
$currentContent = $currentContent.Replace('<VersionPrefix>' + $currentVersion, '<VersionPrefix>' + $newVersion)
Set-Content -Value $currentContent -Path .\BattleNetPrefill\BattleNetPrefill.csproj -NoNewline
# Committing + tag. Pushing the tag is what creates the release.
git commit -a -m "v$newVersion"
git tag "v$newVersion"
git push origin master --tags
Pop-Location