-
Notifications
You must be signed in to change notification settings - Fork 10
/
PackAndPush.ps1
38 lines (29 loc) · 1.3 KB
/
PackAndPush.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
37
38
param()
function Activate() {
$MSBuildPaths = @(
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe",
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe",
"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe",
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
)
for ($i = 0; $i -lt $MSBuildPaths.Count; $i++) {
$MSBuildPath = $MSBuildPaths[$i];
if (Test-Path $MSBuildPath -ErrorAction SilentlyContinue) {
break;
}
}
$solutionPath = (Resolve-Path ".\src\Watts\Watts.csproj")
Write-Host "Building release $solutionPath..."
& $MSBuildPath /t:Build /m /nologo /verbosity:quiet /p:Configuration=Release $solutionPath
$nuspecPath = (Resolve-Path ".\Watts.nuspec").Path
[xml]$nuspecXml = Get-Content $nuspecPath
$version = $nuspecXml.package.metadata.version
$confirmation = Read-Host -Prompt "Are you sure you want to push v$version (y/n)"
if (!($confirmation.ToLower() -eq "y")) {
return
}
nuget pack .\Watts.nuspec
nuget push ".\WebApiToTypeScript.$version.nupkg" -Source https://www.nuget.org/api/v2/package
Remove-Item *.nupkg -Force
}
Activate