@@ -28,50 +28,52 @@ jobs:
2828 - name : Restore dependencies
2929 run : dotnet restore
3030
31- - name : Build win-x86 self-contained
31+ - name : Build win-x86 self-contained (Single File)
3232 run : |
33- dotnet publish -c Release -r win-x86 --self-contained true -p:PublishSingleFile=false -o ./publish/win-x86-self-contained
33+ dotnet publish Ntk.Tools.AutoType.csproj -c Release -r win-x86 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:EnableCompressionInSingleFile=true -p:DebugType=none -p:DebugSymbols= false -o ./publish/win-x86
3434
35- - name : Build win-x64 self-contained
35+ - name : Build win-x64 self-contained (Single File)
3636 run : |
37- dotnet publish -c Release -r win-x64 --self-contained true -p:PublishSingleFile=false -o ./publish/win-x64-self-contained
37+ dotnet publish Ntk.Tools.AutoType.csproj -c Release -r win-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:EnableCompressionInSingleFile=true -p:DebugType=none -p:DebugSymbols= false -o ./publish/win-x64
3838
39- - name : Build win-x86 framework-dependent
39+ - name : Build win-x86 framework-dependent (Single File)
4040 run : |
41- dotnet publish -c Release -r win-x86 --self-contained false -o ./publish/win-x86-framework-dependent
41+ dotnet publish Ntk.Tools.AutoType.csproj -c Release -r win-x86 --self-contained false -p:PublishSingleFile=true -p:DebugType=none -p:DebugSymbols=false - o ./publish/win-x86-fd
4242
43- - name : Build win-x64 framework-dependent
43+ - name : Build win-x64 framework-dependent (Single File)
4444 run : |
45- dotnet publish -c Release -r win-x64 --self-contained false -o ./publish/win-x64-framework-dependent
45+ dotnet publish Ntk.Tools.AutoType.csproj -c Release -r win-x64 --self-contained false -p:PublishSingleFile=true -p:DebugType=none -p:DebugSymbols=false - o ./publish/win-x64-fd
4646
47- - name : Create artifacts directory
47+ - name : Create artifacts directory and prepare files
4848 shell : pwsh
4949 run : |
5050 New-Item -ItemType Directory -Force -Path ./artifacts | Out-Null
5151
52- - name : Create ZIP archives
53- shell : pwsh
54- run : |
55- # Create ZIP files preserving directory structure
56- $compressParams = @{
57- Path = './publish/win-x86-self-contained'
58- DestinationPath = './artifacts/win-x86-self-contained.zip'
59- CompressionLevel = 'Optimal'
60- Force = $true
61- }
62- Compress-Archive @compressParams
52+ # Clean up extra files from each build directory and copy exe files to artifacts
53+ $buildDirs = @(
54+ @{Source='./publish/win-x86'; Dest='win-x86-self-contained.exe'},
55+ @{Source='./publish/win-x64'; Dest='win-x64-self-contained.exe'},
56+ @{Source='./publish/win-x86-fd'; Dest='win-x86-framework-dependent.exe'},
57+ @{Source='./publish/win-x64-fd'; Dest='win-x64-framework-dependent.exe'}
58+ )
6359
64- $compressParams.DestinationPath = './artifacts/win-x64-self-contained.zip'
65- $compressParams.Path = './publish/win-x64-self-contained'
66- Compress-Archive @compressParams
67-
68- $compressParams.DestinationPath = './artifacts/win-x86-framework-dependent.zip'
69- $compressParams.Path = './publish/win-x86-framework-dependent'
70- Compress-Archive @compressParams
60+ foreach ($dir in $buildDirs) {
61+ if (Test-Path $dir.Source) {
62+ # Remove extra files, keep only .exe
63+ Get-ChildItem -Path $dir.Source -File | Where-Object { $_.Extension -ne '.exe' } | Remove-Item -Force
64+ # Remove subdirectories
65+ Get-ChildItem -Path $dir.Source -Directory | Remove-Item -Recurse -Force
66+
67+ # Copy exe file to artifacts with descriptive name
68+ $exePath = Join-Path $dir.Source 'Ntk.Tools.AutoType.exe'
69+ if (Test-Path $exePath) {
70+ Copy-Item -Path $exePath -Destination "./artifacts/$($dir.Dest)" -Force
71+ Write-Host "Copied $($dir.Dest)"
72+ }
73+ }
74+ }
7175
72- $compressParams.DestinationPath = './artifacts/win-x64-framework-dependent.zip'
73- $compressParams.Path = './publish/win-x64-framework-dependent'
74- Compress-Archive @compressParams
76+ Write-Host "Artifacts prepared successfully"
7577
7678 - name : Get version from project
7779 id : get_version
@@ -101,15 +103,17 @@ jobs:
101103 body : |
102104 ## نسخه ${{ steps.get_version.outputs.version }}
103105
104- این نسخه شامل 4 نسخه مختلف برای دانلود است:
106+ این نسخه شامل 4 نسخه مختلف برای دانلود است (همه به صورت Single File):
107+
108+ - **win-x86 self-contained**: نسخه مستقل تک فایلی برای Windows x86 (نیاز به نصب .NET ندارد)
105109
106- - **win-x86 self-contained**: نسخه مستقل برای Windows x86 (نیاز به نصب .NET ندارد)
110+ - **win-x64 self-contained**: نسخه مستقل تک فایلی برای Windows x64 (نیاز به نصب .NET ندارد)
107111
108- - **win-x64 self-contained **: نسخه مستقل برای Windows x64 (نیاز به نصب .NET ندارد )
112+ - **win-x86 framework-dependent **: نسخه وابسته به .NET تک فایلی برای Windows x86 (نیاز به نصب .NET 8.0 Runtime دارد )
109113
110- - **win-x86 framework-dependent**: نسخه وابسته به .NET Framework برای Windows x86
114+ - **win-x64 framework-dependent**: نسخه وابسته به .NET تک فایلی برای Windows x64 (نیاز به نصب .NET 8.0 Runtime دارد)
111115
112- - **win-x64 framework-dependent **: نسخه وابسته به .NET Framework برای Windows x64
116+ **نکته **: همه نسخهها به صورت Single File هستند و مستقیماً به صورت فایل اجرایی (.exe) قابل دانلود میباشند.
113117
114118 ### تغییرات
115119
@@ -119,10 +123,10 @@ jobs:
119123
120124 - تاریخ: ${{ github.event.head_commit.timestamp }}
121125 files : |
122- ./artifacts/win-x86-self-contained.zip
123- ./artifacts/win-x64-self-contained.zip
124- ./artifacts/win-x86-framework-dependent.zip
125- ./artifacts/win-x64-framework-dependent.zip
126+ ./artifacts/win-x86-self-contained.exe
127+ ./artifacts/win-x64-self-contained.exe
128+ ./artifacts/win-x86-framework-dependent.exe
129+ ./artifacts/win-x64-framework-dependent.exe
126130 draft : false
127131 prerelease : false
128132 generate_release_notes : false
0 commit comments