LANCommander/LANCommander.Build/Include/Build-Server.ps1

58 lines
2.2 KiB
PowerShell
Raw Permalink Normal View History

2025-03-21 01:23:15 -05:00
function Build-Server {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[SemVer] $Version,
[String] $Runtime,
[String] $Architecture,
[String] $Platform,
[String] $Configuration
)
$AssemblyVersion = "$($Version.Major).$($Version.Minor).$($Version.Patch)"
2025-03-21 18:34:39 -05:00
$RuntimeIdentifier = "$Runtime-$Architecture"
2025-03-21 01:23:15 -05:00
dotnet restore
npm install --prefix ./LANCommander.UI
npm install --prefix ./LANCommander.Server
2025-03-21 18:40:28 -05:00
dotnet publish ./LANCommander.AutoUpdater/LANCommander.AutoUpdater.csproj -c $Configuration --self-contained --runtime $RuntimeIdentifier -p:Version="$Version" -p:AssemblyVersion="$AssemblyVersion"
dotnet publish ./LANCommander.Server/LANCommander.Server.csproj -c $Configuration --self-contained --runtime $RuntimeIdentifier -p:Version="$Version" -p:AssemblyVersion="$AssemblyVersion"
2025-03-21 01:23:15 -05:00
2025-03-21 18:34:39 -05:00
Copy-Item -Force -Recurse -Verbose LANCommander.AutoUpdater/bin/$Configuration/net9.0/$RuntimeIdentifier/publish/* LANCommander.Server/bin/$Configuration/net9.0/$RuntimeIdentifier/publish/
2025-03-21 01:23:15 -05:00
$PathsToRemove = @(
'wwwroot/_content/BootstrapBlazor.PdfReader/compat',
'wwwroot/_content/BootstrapBlazor.PdfReader/2.*',
'wwwroot/_content/BootstrapBlazor.PdfReader/build/pdf.sandbox.js',
'wwwroot/_content/BootstrapBlazor.PdfReader/build/*.map',
'wwwroot/_content/BootstrapBlazor.PdfReader/web/*.map',
'wwwroot/_content/AntDesign/less',
'wwwroot/_content/BlazorMonaco/lib/monaco-editor/min-maps',
'wwwroot/Identity/lib/bootstrap',
'LANCommander.ico',
'LANCommanderDark.ico',
'package-lock.json',
'package.json',
'*.pdb',
'hostfxr.dll.bak',
'Libraries/locales'
)
2025-03-21 18:34:39 -05:00
$BasePath = "LANCommander.Server/bin/$Configuration/net9.0/$RuntimeIdentifier/publish"
2025-03-21 01:23:15 -05:00
foreach ($path in $PathsToRemove) {
2025-03-21 19:07:48 -05:00
Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$BasePath/$path"
2025-03-21 01:23:15 -05:00
}
$Compress = @{
2025-03-21 18:34:39 -05:00
Path = "LANCommander.Server/bin/$Configuration/net9.0/$RuntimeIdentifier/publish/*"
2025-03-21 18:40:28 -05:00
DestinationPath = "LANCommander.Server-$Platform-$Architecture-v$Version.zip"
2025-03-21 01:23:15 -05:00
CompressionLevel = "Fastest"
}
Compress-Archive @compress
$Compress.Path
}