-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.ps1
38 lines (31 loc) · 1.42 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
# Stop executing script if a cmdlet fails
$ErrorActionPreference = "Stop"
$publishFolder = "Publish"
Write-Output "`nDeleting existing Publish folder..."
if (Test-Path $publishFolder) {
Remove-Item $publishFolder -Recurse -Force
}
$publishProfiles = Get-ChildItem "Properties/PublishProfiles" -Filter *.pubxml
foreach ($file in $publishProfiles) {
$profileName = [System.IO.Path]::GetFileNameWithoutExtension($file.Name)
Write-Output "`nStarting build for $profileName..."
dotnet publish AssEmbly.csproj -p:PublishProfile="Properties/PublishProfiles/$profileName.pubxml" -p:TreatWarningsAsErrors=true -warnaserror
if ($LastExitCode -ne 0) {
exit $LastExitCode
}
}
Write-Output ""
$subFolders = Get-ChildItem $publishFolder -Directory
foreach ($folder in $subFolders) {
$zipName = "AssEmbly-" + $folder.Name + ".zip"
Write-Output "Compressing into $zipName..."
$zipPath = Join-Path $publishFolder $zipName
Get-ChildItem -Path $folder, "LICENSE" -Exclude "*.pdb" |
Compress-Archive -DestinationPath $zipPath -CompressionLevel Optimal
}
Write-Output "`nBuilding documentation..."
.\build-docs.ps1
$docsZipPath = Join-Path $publishFolder "ReferenceManual.zip"
Write-Output "`nCompressing documentation..."
Compress-Archive -Path "Documentation\ReferenceManual\Build\ReferenceManual.*", "Documentation\LICENSE" -DestinationPath $docsZipPath -CompressionLevel Optimal
Write-Output "Done."