-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
35 lines (28 loc) · 1.02 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
Param(
[switch] $Release
)
$ErrorActionPreference = 'Stop'
# Options
$configuration = 'Release'
$artifactsDir = Join-Path (Resolve-Path .) 'artifacts'
$binDir = Join-Path $artifactsDir 'Bin'
$logsDir = Join-Path $artifactsDir 'Logs'
# Detection
. $PSScriptRoot\build\Get-DetectedCiVersion.ps1
$versionInfo = Get-DetectedCiVersion -Release:$Release
Update-CiServerBuildName $versionInfo.ProductVersion
Write-Host "Building using version $($versionInfo.ProductVersion)"
$dotnetArgs = @(
'--configuration', $configuration
'/p:RepositoryCommit=' + $versionInfo.CommitHash
'/p:Version=' + $versionInfo.ProductVersion
'/p:FileVersion=' + $versionInfo.FileVersion
'/p:ContinuousIntegrationBuild=' + ($env:CI -or $env:TF_BUILD)
)
# Build
dotnet build /bl:$logsDir\build.binlog @dotnetArgs
if ($LastExitCode) { exit 1 }
# Publish
Remove-Item -Recurse -Force $binDir -ErrorAction Ignore
dotnet publish src\YouTubeDownloadTool --no-build --output $binDir /bl:$logsDir\publish.binlog @dotnetArgs
if ($LastExitCode) { exit 1 }