-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpublish.ps1
40 lines (32 loc) · 1.82 KB
/
publish.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
param(
[string[]]$runTimes = @("win-x64", "linux-x64", "linux-arm64", "osx-x64")
)
# other runtimes that might work: https://learn.microsoft.com/en-us/dotnet/core/rid-catalog
$version = "0.4.27"
$fullName = "dig"
$names = @("dig", "server")
$src = "src"
$outputRoot = "./publish"
$framework = "net8.0"
if (Test-Path -Path $outputRoot) {
Remove-Item $outputRoot -Recurse -Force
}
function Publish-Project {
param(
[string]$name,
[string]$runtime
)
# dotnet clean ./$src/$name/$name.csproj -c Release -r $runtime -f $framework
dotnet restore ./$src/$name/$name.csproj -r $runtime
# fully standalone with embedded dotnet framework
dotnet publish ./$src/$name/$name.csproj -c Release -r $runtime --no-restore --framework $framework --self-contained true /p:PublishReadyToRunComposite=true /p:Version=$version /p:PublishSingleFile=True /p:PublishTrimmed=false /p:IncludeNativeLibrariesForSelfExtract=True /p:StripSymbols=true /p:PublishDir="bin\Release\$framework\$runtime\" --output $outputRoot/standalone/$runtime
# single file without embedded dotnet framework
# dotnet publish ./$src/$name/$name.csproj -c Release -r $runtime --no-restore --framework $framework --self-contained false /p:PublishReadyToRun=false /p:Version=$version /p:PublishSingleFile=True /p:PublishTrimmed=false /p:IncludeNativeLibrariesForSelfExtract=True /p:StripSymbols=true /p:PublishDir="bin\Release\$framework\$runtime\" --output $outputRoot/singlefile/$runtime
}
foreach ($runTime in $runTimes) {
foreach ($name in $names) {
Publish-Project -name $name -runtime $runTime
}
# zip up the standalone version
Compress-Archive -CompressionLevel Optimal -Path $outputRoot/standalone/$runtime/* -DestinationPath $outputRoot/$fullName-$version-$runtime.zip
}