@@ -4,28 +4,56 @@ $root = Resolve-Path (Join-Path $PSScriptRoot "..\..")
44Set-Location $root
55
66$artifacts = Join-Path $root " artifacts"
7+ $publish = Join-Path $root " publish"
78if (Test-Path $artifacts ) { Remove-Item $artifacts - Recurse - Force }
9+ if (Test-Path $publish ) { Remove-Item $publish - Recurse - Force }
810New-Item - ItemType Directory - Path $artifacts | Out-Null
11+ New-Item - ItemType Directory - Path $publish | Out-Null
12+ New-Item - ItemType Directory - Path (Join-Path $publish " app" ) | Out-Null
13+ New-Item - ItemType Directory - Path (Join-Path $publish " console" ) | Out-Null
914
1015Write-Host " Restoring and testing..." - ForegroundColor Cyan
1116dotnet restore .\PtpLabClock.sln
1217dotnet test .\PtpLabClock.sln - c Release -- no- restore
1318
14- dotnet publish .\src\PtpLabClock.App\PtpLabClock.App.csproj - c Release - r win- x64 -- self- contained false - p:PublishSingleFile= true - p:PublishReadyToRun= false - o .\artifacts\PtpLabClock.App.win- x64.framework- dependent
15- dotnet publish .\src\PtpLabClock.App\PtpLabClock.App.csproj - c Release - r win- x64 -- self- contained true - p:PublishSingleFile= true - p:IncludeNativeLibrariesForSelfExtract= true - p:EnableCompressionInSingleFile= true - p:PublishReadyToRun= false - o .\artifacts\PtpLabClock.App.win- x64.self- contained
16- dotnet publish .\src\PtpLabClock.Console\PtpLabClock.Console.csproj - c Release - r win- x64 -- self- contained true - p:PublishSingleFile= true - p:IncludeNativeLibrariesForSelfExtract= true - p:EnableCompressionInSingleFile= true - p:PublishReadyToRun= false - o .\artifacts\PtpLabClock.Console.win- x64.self- contained
19+ $singleFileProps = @ (
20+ " -p:PublishSingleFile=true" ,
21+ " -p:SelfContained=true" ,
22+ " -p:IncludeNativeLibrariesForSelfExtract=true" ,
23+ " -p:EnableCompressionInSingleFile=true" ,
24+ " -p:PublishReadyToRun=false" ,
25+ " -p:PublishTrimmed=false" ,
26+ " -p:DebugType=None" ,
27+ " -p:DebugSymbols=false"
28+ )
1729
18- foreach ($dir in Get-ChildItem .\artifacts - Directory) {
19- Copy-Item .\LICENSE $dir.FullName - Force
20- Copy-Item .\NOTICE $dir.FullName - Force
21- Copy-Item .\THIRD- PARTY- NOTICES.md $dir.FullName - Force
22- Copy-Item .\docs\release- readme.md (Join-Path $dir.FullName " README-FIRST.md" ) - Force
23- Compress-Archive - Path (Join-Path $dir.FullName " *" ) - DestinationPath " .\artifacts\$ ( $dir.Name ) .zip" - Force
30+ Write-Host " Publishing self-contained single EXE artifacts..." - ForegroundColor Cyan
31+ dotnet publish .\src\PtpLabClock.App\PtpLabClock.App.csproj - c Release - r win- x64 -- self- contained true @singleFileProps - o .\publish\app
32+ dotnet publish .\src\PtpLabClock.Console\PtpLabClock.Console.csproj - c Release - r win- x64 -- self- contained true @singleFileProps - o .\publish\console
33+
34+ Copy-Item .\publish\app\PtpLabClock.App.exe .\artifacts\PtpLabClock.App.win-x64.portable.exe - Force
35+ Copy-Item .\publish\console\PtpLabClock.Console.exe .\artifacts\PtpLabClock.Console.win-x64.portable.exe - Force
36+
37+ $packages = @ (
38+ @ { Name = " PtpLabClock.App.win-x64.portable" ; Exe = " .\artifacts\PtpLabClock.App.win-x64.portable.exe" },
39+ @ { Name = " PtpLabClock.Console.win-x64.portable" ; Exe = " .\artifacts\PtpLabClock.Console.win-x64.portable.exe" }
40+ )
41+
42+ foreach ($package in $packages ) {
43+ $dir = Join-Path " .\artifacts" $package.Name
44+ New-Item - ItemType Directory - Path $dir - Force | Out-Null
45+ Copy-Item $package.Exe (Join-Path $dir (Split-Path $package.Exe - Leaf)) - Force
46+ Copy-Item .\LICENSE $dir - Force
47+ Copy-Item .\NOTICE $dir - Force
48+ Copy-Item .\THIRD- PARTY- NOTICES.md $dir - Force
49+ Copy-Item .\docs\release- readme.md (Join-Path $dir " README-FIRST.md" ) - Force
50+ Compress-Archive - Path (Join-Path $dir " *" ) - DestinationPath " .\artifacts\$ ( $package.Name ) .zip" - Force
2451}
2552
26- Get-ChildItem .\artifacts - Filter * . zip | Sort-Object Name | ForEach-Object {
53+ Get-ChildItem .\artifacts - File | Where-Object { $_ .Extension -in " .exe " , " . zip" } | Sort-Object Name | ForEach-Object {
2754 $hash = Get-FileHash $_.FullName - Algorithm SHA256
2855 " $ ( $hash.Hash.ToLowerInvariant ()) $ ( $_.Name ) "
2956} | Set-Content .\artifacts\checksums.txt - Encoding UTF8
3057
31- Write-Host " Release packages written to artifacts/." - ForegroundColor Green
58+ Write-Host " Portable release files written to artifacts/:" - ForegroundColor Green
59+ Get-ChildItem .\artifacts - File | Sort-Object Name | Select-Object Name, Length | Format-Table - AutoSize
0 commit comments