-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
56 lines (45 loc) · 1.86 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
[CmdletBinding(PositionalBinding = $false)]
param(
[switch] $Publish,
[switch] $Npm
)
Write-Host "Run Parameters:" -ForegroundColor Cyan
Write-Host " Publish: $Publish"
Write-Host " dotnet --version:" (dotnet --version)
$publishDir = "$PSScriptRoot\docs"
$publishProfileOut = "$PSScriptRoot\src\XdtPlayground\bin\publish-gh-pages\wwwroot"
$npmBuildDir = "$PSScriptRoot\src\XdtPlayground\Monaco"
# ----------NPM BUILD------------
if ($Npm) {
Write-Host "npm build" -ForegroundColor "Magenta"
Push-Location -Path "$npmBuildDir" -PassThru
npm install
npm run build-prod
if ($LastExitCode -ne 0) {
Write-Host "Error with Build Monaco, aborting build." -Foreground "Red"
pop-Location -PassThru
Exit 1
}
pop-Location -PassThru
}
# ----------.NET BUILD------------
Write-Host "Restoring all projects..." -ForegroundColor "Magenta"
dotnet restore
Write-Host "Done restoring." -ForegroundColor "Green"
Write-Host "Building all projects..." -ForegroundColor "Magenta"
dotnet build -c Release --no-restore
Write-Host "Done building." -ForegroundColor "Green"
# ----------PUBLISH------------
if ($Publish) {
mkdir -Force $publishDir | Out-Null
Write-Host "Clearing existing $publishDir..." -NoNewline
Get-ChildItem $publishDir -Recurse | Remove-Item -Force -Recurse
Write-Host "done." -ForegroundColor "Green"
Write-Host "Publishing ..." -ForegroundColor "Magenta"
dotnet build -c Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile
Write-Host "Copy from $publishProfileOut\* to $publishDir" -ForegroundColor "Magenta"
Copy-Item -Path $publishProfileOut\* -Destination $publishDir -Recurse
Write-Host "Delete *.br , *.gz"
Remove-Item $publishDir -Recurse -Force -Include *.br , *.gz
}
Write-Host "Build Complete." -ForegroundColor "Green"