Skip to content

Commit f648e3f

Browse files
authored
Merge pull request #2504 from Krypton-Suite/2503-feature-request-add-the-ability-to-create-zip-files-for-binaries
* Implement #2503
2 parents 01f9097 + 5b50a9c commit f648e3f

File tree

6 files changed

+470
-45
lines changed

6 files changed

+470
-45
lines changed

.github/workflows/build.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,121 @@ jobs:
7474

7575
- name: Build
7676
run: msbuild "Scripts/nightly.proj" /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU"
77+
78+
release:
79+
runs-on: windows-2022
80+
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
81+
needs: build
82+
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@v5
86+
87+
# .NET 9 (GA)
88+
- name: Setup .NET 9
89+
uses: actions/setup-dotnet@v4
90+
with:
91+
dotnet-version: 9.0.x
92+
93+
# .NET 10 (Preview)
94+
- name: Setup .NET 10 (preview)
95+
uses: actions/setup-dotnet@v4
96+
with:
97+
dotnet-version: 10.0.x
98+
dotnet-quality: preview
99+
100+
# global.json dynamisch erzeugen
101+
- name: Force .NET 10 SDK via global.json
102+
run: |
103+
$sdkVersion = (dotnet --list-sdks | Select-String "10.0").ToString().Split(" ")[0]
104+
Write-Output "Using SDK $sdkVersion"
105+
@"
106+
{
107+
"sdk": {
108+
"version": "$sdkVersion",
109+
"rollForward": "latestFeature"
110+
}
111+
}
112+
"@ | Out-File -Encoding utf8 global.json
113+
114+
- name: Setup MSBuild
115+
uses: microsoft/setup-msbuild@v2
116+
with:
117+
msbuild-architecture: x64
118+
119+
- name: Setup NuGet
120+
uses: NuGet/[email protected]
121+
122+
- name: Cache NuGet
123+
uses: actions/cache@v4
124+
with:
125+
path: ~/.nuget/packages
126+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
127+
restore-keys: |
128+
${{ runner.os }}-nuget-
129+
130+
- name: Restore
131+
run: dotnet restore "Source/Krypton Components/Krypton Toolkit Suite 2022 - VS2022.sln"
132+
133+
- name: Build Release
134+
run: msbuild "Scripts/build.proj" /t:Build /p:Configuration=Release /p:Platform="Any CPU"
135+
136+
- name: Pack Release
137+
run: msbuild "Scripts/build.proj" /t:Pack /p:Configuration=Release /p:Platform="Any CPU"
138+
139+
- name: Create Release Archives
140+
run: msbuild "Scripts/build.proj" /t:CreateAllReleaseArchives /p:Configuration=Release /p:Platform="Any CPU"
141+
142+
- name: Get Version
143+
id: get_version
144+
run: |
145+
$version = (dotnet build "Source/Krypton Components/Krypton.Toolkit/Krypton.Toolkit.csproj" --no-restore --verbosity quiet | Select-String "Version" | ForEach-Object { $_.Line.Split('=')[1].Trim() })
146+
if (-not $version) {
147+
$version = "100.25.1.1" # Fallback version
148+
}
149+
echo "version=$version" >> $env:GITHUB_OUTPUT
150+
echo "tag=v$version" >> $env:GITHUB_OUTPUT
151+
152+
- name: Create Release
153+
run: |
154+
$releaseBody = @"
155+
## Krypton Toolkit Suite Release ${{ steps.get_version.outputs.version }}
156+
157+
This release includes:
158+
- All Krypton Toolkit components
159+
- NuGet packages for multiple target frameworks
160+
- Release archives (ZIP and TAR.GZ formats)
161+
162+
### Downloads
163+
- **ZIP Archive**: `Krypton-Release_*.zip`
164+
- **TAR.GZ Archive**: `Krypton-Release_*.tar.gz`
165+
166+
### Target Frameworks
167+
- .NET Framework 4.7.2
168+
- .NET Framework 4.8
169+
- .NET Framework 4.8.1
170+
- .NET 8.0 Windows
171+
- .NET 9.0 Windows
172+
- .NET 10.0 Windows
173+
"@
174+
175+
gh release create ${{ steps.get_version.outputs.tag }} `
176+
--title "Release ${{ steps.get_version.outputs.version }}" `
177+
--notes "$releaseBody" `
178+
--latest
179+
env:
180+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
181+
182+
- name: Upload Release Assets
183+
run: |
184+
$zipFile = Get-ChildItem "Bin/Release/Zips/Krypton-Release_*.zip" | Select-Object -First 1
185+
$tarFile = Get-ChildItem "Bin/Release/Zips/Krypton-Release_*.tar.gz" | Select-Object -First 1
186+
187+
if ($zipFile) {
188+
gh release upload ${{ steps.get_version.outputs.tag }} "$($zipFile.FullName)" --clobber
189+
}
190+
if ($tarFile) {
191+
gh release upload ${{ steps.get_version.outputs.tag }} "$($tarFile.FullName)" --clobber
192+
}
193+
env:
194+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Documents/Changelog/Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
====
44

55
## 2025-11-xx - Build 2511 (V10 - alpha) - November 2025
6+
* Implemented [#2503](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2503), Add the ability to create zip files for binaries
67
* Implemented [#952](https://github.com/Krypton-Suite/Standard-Toolkit/issues/952), Place built NuGet packages into separate directory
78
* Implemented [#892](https://github.com/Krypton-Suite/Standard-Toolkit/issues/892), `KryptonButton` UAC Shield icons need to match the OS style
89
* Resolved [#2514](https://github.com/Krypton-Suite/Standard-Toolkit/issues/2514), `KryptonPanel.OnPaint` does not call base.

Scripts/build.proj

Lines changed: 58 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,34 @@
11
<Project>
22
<Import Project="..\Directory.Build.props" />
3-
3+
44
<PropertyGroup>
55
<RootFolder>$(MSBuildProjectDirectory)</RootFolder>
66
<Configuration>Release</Configuration>
7+
<ReleaseBuildPath>..\Bin\Release\Zips</ReleaseBuildPath>
8+
<ReleaseZipName>Krypton-Release</ReleaseZipName>
79
</PropertyGroup>
810

911
<Target Name="Clean">
1012
<ItemGroup>
1113
<Projects Include="..\Source\Krypton Components\Krypton.*\*.csproj" />
1214
</ItemGroup>
1315
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" Targets="Clean" />
14-
</Target>
16+
</Target>
1517

1618
<Target Name="Restore">
1719
<ItemGroup>
1820
<Projects Include="..\Source\Krypton Components\Krypton.*\*.csproj" />
1921
</ItemGroup>
2022
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" Targets="Restore" />
2123
</Target>
22-
24+
2325
<Target Name="Build" DependsOnTargets="Restore">
2426
<ItemGroup>
2527
<Projects Include="..\Source\Krypton Components\Krypton.*\*.csproj" />
2628
</ItemGroup>
2729
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" />
2830
</Target>
29-
31+
3032
<Target Name="CleanPackages">
3133
<ItemGroup>
3234
<NugetPkgs Include="..\Bin\Packages\Release\*.nupkg" />
@@ -49,7 +51,7 @@
4951
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=lite" Targets="Restore" />
5052
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=lite" Targets="Pack" />
5153
</Target>
52-
54+
5355
<Target Name="PackAll">
5456
<ItemGroup>
5557
<Projects Include="..\Source\Krypton Components\Krypton.*\*.csproj" />
@@ -65,13 +67,62 @@
6567
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" Targets="Restore" />
6668
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" Targets="Pack" />
6769
</Target>
68-
70+
6971
<Target Name="Pack" DependsOnTargets="CleanPackages;PackLite;PackAll" />
70-
72+
7173
<Target Name="Push">
7274
<ItemGroup>
7375
<NugetPkgs Include="..\Bin\Packages\Release\*.$(LibraryVersion).nupkg" />
7476
</ItemGroup>
7577
<Exec Command="nuget.exe push %(NugetPkgs.Identity)" />
7678
</Target>
79+
80+
<Target Name="CreateReleaseZip">
81+
<PropertyGroup>
82+
<StringDate>$([System.DateTime]::Now.ToString('yyyyMMdd'))</StringDate>
83+
</PropertyGroup>
84+
<ItemGroup>
85+
<DebugApplicationFiles Include="..\Bin\Release\**\*.*" Exclude="..\Bin\Release\*vshost.exe*;..\Bin\Release\**\*.json;..\Bin\Release\**\*.pdb" />
86+
</ItemGroup>
87+
<MakeDir Directories="$(ReleaseBuildPath)"/>
88+
89+
<!-- Using 7-Zip for ZIP creation (compatible with all MSBuild versions) -->
90+
<Exec Command="7z.exe a -tzip &quot;$(ReleaseBuildPath)\$(ReleaseZipName)_$(StringDate).zip&quot; &quot;..\Bin\Release\*&quot; -x!*.json -x!*.pdb"
91+
Condition="Exists('C:\Program Files\7-Zip\7z.exe')"
92+
WorkingDirectory="$(ReleaseBuildPath)" />
93+
94+
<!-- Fallback: Using PowerShell Compress-Archive if 7-Zip not available -->
95+
<Exec Command="powershell.exe -Command &quot;Get-ChildItem '..\Bin\Release\*' -Recurse | Where-Object {$_.Extension -notin '.json','.pdb'} | Compress-Archive -DestinationPath '$(ReleaseBuildPath)\$(ReleaseZipName)_$(StringDate).zip' -Force&quot;"
96+
Condition="!Exists('C:\Program Files\7z.exe')" />
97+
</Target>
98+
99+
<Target Name="CreateReleaseTar">
100+
<PropertyGroup>
101+
<StringDate>$([System.DateTime]::Now.ToString('yyyyMMdd'))</StringDate>
102+
</PropertyGroup>
103+
<ItemGroup>
104+
<DebugApplicationFiles Include="..\Bin\Release\**\*.*" Exclude="..\Bin\Release\*vshost.exe*;..\Bin\Release\**\*.json;..\Bin\Release\**\*.pdb" />
105+
</ItemGroup>
106+
<MakeDir Directories="$(ReleaseBuildPath)"/>
107+
108+
<!-- Method 1: Using 7-Zip if available (recommended for Windows) -->
109+
<Exec Command="7z.exe a -ttar &quot;$(ReleaseBuildPath)\$(ReleaseZipName)_$(StringDate).tar&quot; &quot;..\Bin\Release\*&quot; -x!*.json -x!*.pdb"
110+
Condition="Exists('C:\Program Files\7-Zip\7z.exe')"
111+
WorkingDirectory="$(ReleaseBuildPath)" />
112+
<Exec Command="7z.exe a -tgzip &quot;$(ReleaseBuildPath)\$(ReleaseZipName)_$(StringDate).tar.gz&quot; &quot;$(ReleaseBuildPath)\$(ReleaseZipName)_$(StringDate).tar&quot;"
113+
Condition="Exists('C:\Program Files\7-Zip\7z.exe')"
114+
WorkingDirectory="$(ReleaseBuildPath)" />
115+
<Delete Files="$(ReleaseBuildPath)\$(ReleaseZipName)_$(StringDate).tar"
116+
Condition="Exists('C:\Program Files\7-Zip\7z.exe')" />
117+
118+
<!-- Method 2: Using PowerShell tar command (Windows 10/11) -->
119+
<Exec Command="powershell.exe -Command tar -czf &quot;$(ReleaseBuildPath)\$(ReleaseZipName)_$(StringDate)_ps.tar.gz&quot; -C &quot;..\Bin\Release&quot; . --exclude=*.json --exclude=*.pdb"
120+
Condition="Exists('C:\Windows\System32\tar.exe')" />
121+
122+
<!-- Method 3: Using Git Bash tar if available -->
123+
<Exec Command="&quot;C:\Program Files\Git\bin\bash.exe&quot; -c &quot;cd ../Bin/Release &amp;&amp; tar -czf &quot;$(ReleaseBuildPath)/$(ReleaseZipName)_$(StringDate)_git.tar.gz&quot; * --exclude=*.json --exclude=*.pdb&quot;"
124+
Condition="Exists('C:\Program Files\Git\bin\bash.exe')" />
125+
</Target>
126+
127+
<Target Name="CreateAllReleaseArchives" DependsOnTargets="CreateReleaseZip;CreateReleaseTar" />
77128
</Project>

Scripts/canary.proj

Lines changed: 55 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
11
<Project>
22
<Import Project="..\Directory.Build.props" />
3-
3+
44
<PropertyGroup>
55
<RootFolder>$(MSBuildProjectDirectory)</RootFolder>
66
<Configuration>Canary</Configuration>
7+
<CanaryBuildPath>..\Bin\Canary\Zips</CanaryBuildPath>
8+
<CanaryZipName>Krypton-Canary</CanaryZipName>
79
</PropertyGroup>
810

911
<Target Name="Clean">
1012
<ItemGroup>
1113
<Projects Include="..\Source\Krypton Components\Krypton.*\*.csproj" />
1214
</ItemGroup>
1315
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" Targets="Clean" />
14-
</Target>
16+
</Target>
1517

1618
<Target Name="Restore">
1719
<ItemGroup>
1820
<Projects Include="..\Source\Krypton Components\Krypton.*\*.csproj" />
1921
</ItemGroup>
2022
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" Targets="Restore" />
2123
</Target>
22-
24+
2325
<Target Name="Build" DependsOnTargets="Restore">
2426
<ItemGroup>
2527
<Projects Include="..\Source\Krypton Components\Krypton.*\*.csproj" />
2628
</ItemGroup>
2729
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" />
2830
</Target>
29-
31+
3032
<Target Name="CleanPackages">
3133
<ItemGroup>
3234
<NugetPkgs Include="..\Bin\Packages\Canary\*.nupkg" />
3335
</ItemGroup>
3436
<Delete Files="@(NugetPkgs)" />
3537
</Target>
36-
38+
3739
<Target Name="PackAll">
3840
<ItemGroup>
3941
<Projects Include="..\Source\Krypton Components\Krypton.*\*.csproj" />
@@ -49,27 +51,65 @@
4951
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" Targets="Restore" />
5052
<MSBuild Projects="@(Projects)" Properties="Configuration=$(Configuration);TFMs=all" Targets="Pack" />
5153
</Target>
52-
53-
<Target Name="Pack" DependsOnTargets="CleanPackages;PackAll" /> <!--PackLite;-->
54-
54+
55+
<Target Name="Pack" DependsOnTargets="CleanPackages;PackAll" />
56+
<!--PackLite;-->
57+
5558
<Target Name="Push">
5659
<ItemGroup>
5760
<NugetPkgs Include="..\Bin\Packages\Canary\*.$(LibraryVersion).nupkg" />
5861
</ItemGroup>
5962
<Exec Command="nuget.exe push %(NugetPkgs.Identity)" />
6063
</Target>
6164

62-
<Target Name="CreateNightlyZip">
65+
66+
67+
<Target Name="CreateCanaryZip">
68+
<PropertyGroup>
69+
<StringDate>$([System.DateTime]::Now.ToString('yyyyMMdd'))</StringDate>
70+
</PropertyGroup>
71+
<ItemGroup>
72+
<DebugApplicationFiles Include="..\Bin\Canary\**\*.*" Exclude="..\Bin\Canary\*vshost.exe*;..\Bin\Canary\**\*.json;..\Bin\Canary\**\*.pdb" />
73+
</ItemGroup>
74+
<MakeDir Directories="$(CanaryBuildPath)"/>
75+
76+
<!-- Using 7-Zip for ZIP creation (compatible with all MSBuild versions) -->
77+
<Exec Command="7z.exe a -tzip &quot;$(CanaryBuildPath)\$(CanaryZipName)_$(StringDate).zip&quot; &quot;..\Bin\Canary\*&quot; -x!*.json -x!*.pdb"
78+
Condition="Exists('C:\Program Files\7-Zip\7z.exe')"
79+
WorkingDirectory="$(CanaryBuildPath)" />
80+
81+
<!-- Fallback: Using PowerShell Compress-Archive if 7-Zip not available -->
82+
<Exec Command="powershell.exe -Command &quot;Get-ChildItem '..\Bin\Canary\*' -Recurse | Where-Object {$_.Extension -notin '.json','.pdb'} | Compress-Archive -DestinationPath '$(CanaryBuildPath)\$(CanaryZipName)_$(StringDate).zip' -Force&quot;"
83+
Condition="!Exists('C:\Program Files\7z.exe')" />
84+
</Target>
85+
86+
<Target Name="CreateCanaryTar">
6387
<PropertyGroup>
6488
<StringDate>$([System.DateTime]::Now.ToString('yyyyMMdd'))</StringDate>
6589
</PropertyGroup>
6690
<ItemGroup>
67-
<DebugApplicationFiles Include="..\Bin\Canary\**\*.*" Exclude="..\Bin\Canary\*vshost.exe*" />
91+
<DebugApplicationFiles Include="..\Bin\Canary\**\*.*" Exclude="..\Bin\Canary\*vshost.exe*;..\Bin\Canary\**\*.json;..\Bin\Canary\**\*.pdb" />
6892
</ItemGroup>
69-
<MakeDir Directories="$(NightlyBuildPath)"/>
70-
<Zip Files="@(DebugApplicationFiles)"
71-
WorkingDirectory="..\Bin\Canary"
72-
ZipFileName="$(NightlyBuildPath)\$(StringDate)_$(NightlyZipName).zip"
73-
ZipLevel="9" />
93+
<MakeDir Directories="$(CanaryBuildPath)"/>
94+
95+
<!-- Method 1: Using 7-Zip if available (recommended for Windows) -->
96+
<Exec Command="7z.exe a -ttar &quot;$(CanaryBuildPath)\$(CanaryZipName)_$(StringDate).tar&quot; &quot;..\Bin\Canary\*&quot; -x!*.json -x!*.pdb"
97+
Condition="Exists('C:\Program Files\7-Zip\7z.exe')"
98+
WorkingDirectory="$(CanaryBuildPath)" />
99+
<Exec Command="7z.exe a -tgzip &quot;$(CanaryBuildPath)\$(CanaryZipName)_$(StringDate).tar.gz&quot; &quot;$(CanaryBuildPath)\$(CanaryZipName)_$(StringDate).tar&quot;"
100+
Condition="Exists('C:\Program Files\7-Zip\7z.exe')"
101+
WorkingDirectory="$(CanaryBuildPath)" />
102+
<Delete Files="$(CanaryBuildPath)\$(CanaryZipName)_$(StringDate).tar"
103+
Condition="Exists('C:\Program Files\7-Zip\7z.exe')" />
104+
105+
<!-- Method 2: Using PowerShell tar command (Windows 10/11) -->
106+
<Exec Command="powershell.exe -Command tar -czf &quot;$(CanaryBuildPath)\$(CanaryZipName)_$(StringDate)_ps.tar.gz&quot; -C &quot;..\Bin\Canary&quot; . --exclude=*.json --exclude=*.pdb"
107+
Condition="Exists('C:\Windows\System32\tar.exe')" />
108+
109+
<!-- Method 3: Using Git Bash tar if available -->
110+
<Exec Command="&quot;C:\Program Files\Git\bin\bash.exe&quot; -c &quot;cd ../Bin/Canary &amp;&amp; tar -czf &quot;$(CanaryBuildPath)/$(CanaryZipName)_$(StringDate)_git.tar.gz&quot; * --exclude=*.json --exclude=*.pdb&quot;"
111+
Condition="Exists('C:\Program Files\Git\bin\bash.exe')" />
74112
</Target>
113+
114+
<Target Name="CreateAllCanaryArchives" DependsOnTargets="CreateCanaryZip;CreateCanaryTar" />
75115
</Project>

0 commit comments

Comments
 (0)