-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathProcess-Release.ps1
31 lines (25 loc) · 1.02 KB
/
Process-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
29
30
31
try {
$artifactDirectory = $env:PIPELINE_WORKSPACE
Write-Host "Currect working directory $artifactDirectory"
$nupkg = Get-ChildItem -Path $artifactDirectory -Filter *.nupkg -Recurse | Select-Object -First 1
if($null -eq $nupkg) {
Throw "No NuGet Package could be found in the current directory"
}
Write-Host "Package Name $($nupkg.Name)"
$nupkg.Name -match '^(.*?)\.((?:\.?[0-9]+){3,}(?:[-a-z]+)?)\.nupkg$'
$VersionName = $Matches[2]
$IsPreview = $VersionName -match '-beta$'
$ReleaseDisplayName = $VersionName
Write-Output ("##vso[task.setvariable variable=IS_PREVIEW;]$IsPreview")
if($true -eq $IsPreview) {
$ReleaseDisplayName = "$VersionName - Beta"
}
Write-Host "Version Name" $VersionName
Write-Host "Release Display Name $ReleaseDisplayName"
Write-Output ("##vso[task.setvariable variable=VersionName;]$VersionName")
Write-Output ("##vso[task.setvariable variable=ReleaseDisplayName;]$ReleaseDisplayName")
}
catch {
Write-Error $_
exit 1
}