-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
41 lines (32 loc) · 1.19 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
#!/usr/bin/env pwsh
$configuration = "Release"
$Env:DOTNET_CLI_TELEMETRY_OPTOUT = 'true'
if (!(Test-Path Env:version))
{
$Env:version = "0.0.0.0+LOCAL"
}
Remove-Item -Recurse -Force artifacts -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force tools -ErrorAction SilentlyContinue
Get-ChildItem .\ -include bin,obj -Recurse | ForEach-Object ($_) { Remove-Item $_.fullname -Force -Recurse }
Set-Location src
dotnet tool restore
$numOfCsprojFiles = Get-ChildItem -Include *.sln -Recurse | Measure-Object
if ($numOfCsprojFiles.Count -gt 0)
{
dotnet restore --locked-mode
dotnet build --configuration $configuration --no-restore
dotnet test --logger "trx;LogFileName=../../../artifacts/test-results.trx"
dotnet publish --configuration $configuration --no-build
dotnet pack --configuration $configuration --no-build --output "../artifacts/nupkgs"
}
$packageJsonFiles = Get-ChildItem -Include package.json -Recurse -Depth 2
foreach ($packageJsonFile in $packageJsonFiles)
{
$packageJsonDir = Split-Path $packageJsonFile
Write-Host "Found npm project at $packageJsonDir"
Set-Location $packageJsonDir
npm install
npm run build
Set-Location ..
}
Set-Location ..