Skip to content

Commit f81d818

Browse files
committed
icon
1 parent aff48ef commit f81d818

File tree

4 files changed

+367
-42
lines changed

4 files changed

+367
-42
lines changed

.github/workflows/build-and-release.yml

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Ntk.Tools.AutoType.csproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,17 @@
1515
<UseWindowsForms>true</UseWindowsForms>
1616
</PropertyGroup>
1717

18+
<!-- Single File Output Configuration for Release -->
19+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
20+
<PublishSingleFile>true</PublishSingleFile>
21+
<SelfContained>true</SelfContained>
22+
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
23+
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
24+
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
25+
<PublishTrimmed>false</PublishTrimmed>
26+
<DebugType>none</DebugType>
27+
<DebugSymbols>false</DebugSymbols>
28+
</PropertyGroup>
29+
1830
</Project>
1931

0 commit comments

Comments
 (0)