-
Notifications
You must be signed in to change notification settings - Fork 26
/
_publish-release.ps1
28 lines (23 loc) · 1.01 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
28
Push-Location $PSScriptRoot
clear
# Getting current version
[xml]$parsedCsproj = Get-Content .\SteamPrefill\SteamPrefill.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
return
}
# Updating csproj version
$currentContent = Get-Content -Path .\SteamPrefill\SteamPrefill.csproj -Raw
$currentContent = $currentContent.Replace('<VersionPrefix>' + $currentVersion, '<VersionPrefix>' + $newVersion)
Set-Content -Value $currentContent -Path .\SteamPrefill\SteamPrefill.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