-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSet-NextVersion.ps1
More file actions
30 lines (26 loc) · 875 Bytes
/
Set-NextVersion.ps1
File metadata and controls
30 lines (26 loc) · 875 Bytes
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
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[ValidatePattern("^\d+(\.\d+){2,3}$")]
[string]$NextVersion,
[Parameter(Mandatory = $true)]
[ValidateScript( {
if ( -Not ($_ | Test-Path) ) {
throw "Folder does not exist"
}
if (-Not ($_ | Test-Path -PathType Container) ) {
throw "The Path argument must be a folder. File paths are not allowed."
}
return $true
})]
[System.IO.FileInfo]$GitRepoDirectory
)
. .\Utils\Git.ps1
try {
Write-Host "Setting the next version to $NextVersion..." -ForegroundColor White
Create-Tag -Tag $NextVersion -RepoDirectory $GitRepoDirectory | Out-Null
Write-Host "Successfully setted the next version." -ForegroundColor Green
}
catch {
Write-Error "Failed to set next version. Reason: $($_)"
}