-
Notifications
You must be signed in to change notification settings - Fork 16
/
install-as-tool.ps1
43 lines (34 loc) · 1.14 KB
/
install-as-tool.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
42
43
#!/usr/bin/env pwsh
Function InstallAsTool
{
Param(
[string]
[ValidateNotNullOrEmpty()]
$APP_NAME
)
Write-Output "Installing '$APP_NAME' as tool..."
$ARTIFACTS_DIR = "artifacts/$APP_NAME"
$BUILD_CONFIGURATION = "Release"
$EXE_PROJECT = "src/$APP_NAME/src/app/$APP_NAME.csproj"
Write-Output "Cleaning..."
$COMMAND="dotnet clean -c $BUILD_CONFIGURATION; Remove-Item -Recurse -ErrorAction Ignore $ARTIFACTS_DIR"
Write-Output $COMMAND
Invoke-Expression -Command $COMMAND
Write-Output "Packing..."
$COMMAND="dotnet pack -c $BUILD_CONFIGURATION -o $ARTIFACTS_DIR $EXE_PROJECT"
Write-Output $COMMAND
Invoke-Expression -Command $COMMAND
If ($LASTEXITCODE -ne 0)
{
Write-Output "$APP_NAME will not be installed/upgraded."
Exit
}
Write-Output "Updating tool..."
$COMMAND="dotnet tool update --global --add-source $ARTIFACTS_DIR $APP_NAME"
Write-Output $COMMAND
Invoke-Expression -Command $COMMAND
}
$ErrorActionPreference = "Stop"
Push-Location $(Split-Path $MyInvocation.MyCommand.Path)
InstallAsTool "PortToTripleSlash"
InstallAsTool "PortToDocs"