This repository has been archived by the owner on Oct 21, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.ps1
41 lines (33 loc) · 1.44 KB
/
build.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
39
40
41
Param(
[Parameter(Position = 0)]
[Boolean]$IsBuildAgent = $false,
[Parameter(Position = 1)]
[String]$Configuration = "Release",
[Parameter(Position = 2)]
[String]$VersionSuffix = ""
)
if((-Not ($IsBuildAgent)) -And ([string]::IsNullOrEmpty($VersionSuffix))) {
$VersionSuffix = "1"
}
$VersionSuffixCommand = ""
if(-Not ([string]::IsNullOrEmpty($VersionSuffix))) {
$VersionSuffixCommand = "--version-suffix"
}
Write-Host "Restoring 'TouchPortalApi' component....`n" -foregroundcolor "Magenta"
dotnet restore "TouchPortalApi"
dotnet restore "TouchPortalApi.Tests"
Write-Host "Building 'TouchPortalApi' component...`n" -foregroundcolor "Magenta"
dotnet build "TouchPortalApi" --configuration $Configuration
Write-Host "Cleaning 'TouchPortalApi' packages-dist folder..." -foregroundcolor "Magenta"
$CurrentDir = [System.IO.Path]::GetDirectoryName($myInvocation.MyCommand.Path)
$DistFolderPath = "$CurrentDir\packages-dist"
if (Test-Path $DistFolderPath) {
Remove-Item $DistFolderPath -Force -Recurse
}
Write-Host "Publishing 'TouchPortalApi' component...`n" -foregroundcolor "Magenta"
dotnet pack "TouchPortalApi" --output $DistFolderPath --configuration $Configuration $VersionSuffixCommand $VersionSuffix --include-symbols -p:SymbolPackageFormat=snupkg
if ($IsBuildAgent) {
exit 0
}
Write-Host "Publishing 'TouchPortalApi' component to local NuGet source...`n" -foregroundcolor "Magenta"
dotnet nuget push packages-dist\*.nupkg --source LocalDev