Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 194 additions & 0 deletions .github/workflows/templates-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
# Modifications by Peter Wagner (aka Wagnerp), Simon Coghlan (aka Smurf-IV), tobitege et al. 2026 - 2026. All rights reserved.
#
# KILL-SWITCH: To disable this workflow, set repository variable TEMPLATES_RELEASE_DISABLED=true
# Location: Repository Settings -> Secrets and variables -> Actions -> Variables tab
# To re-enable: Set TEMPLATES_RELEASE_DISABLED=false or delete the variable

name: Templates Release

on:
push:
branches:
- master
- alpha
- canary
- V105-LTS
paths:
- "Templates/**"
- ".github/workflows/templates-release.yml"
workflow_dispatch:

permissions:
contents: write

jobs:
publish-templates:
runs-on: windows-2025-vs2026
environment: production

steps:
- name: Templates Release Kill Switch Check
id: templates_release_kill_switch
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$disabled = '${{ vars.TEMPLATES_RELEASE_DISABLED }}'

if ($disabled -eq 'true') {
Write-Host "::warning:: Templates release workflow is currently DISABLED via kill switch (TEMPLATES_RELEASE_DISABLED=true)"
Write-Host "To re-enable: set TEMPLATES_RELEASE_DISABLED to 'false' or remove the variable."
echo "enabled=false" >> $env:GITHUB_OUTPUT
} else {
Write-Host "Templates release kill switch check has passed, continuing..."
echo "enabled=true" >> $env:GITHUB_OUTPUT
}

- name: Checkout
if: steps.templates_release_kill_switch.outputs.enabled == 'true'
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Resolve templates release channel
if: steps.templates_release_kill_switch.outputs.enabled == 'true'
id: channel
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$branch = "${{ github.ref_name }}"

switch ($branch) {
'master' {
$channel = 'stable'
$tag = 'templates-stable'
$title = 'Krypton Templates (Stable)'
$prerelease = 'false'
}
'canary' {
$channel = 'canary'
$tag = 'templates-canary'
$title = 'Krypton Templates (Canary)'
$prerelease = 'true'
}
'alpha' {
$channel = 'alpha'
$tag = 'templates-alpha'
$title = 'Krypton Templates (Alpha)'
$prerelease = 'true'
}
'V105-LTS' {
$channel = 'lts'
$tag = 'templates-lts'
$title = 'Krypton Templates (LTS)'
$prerelease = 'false'
}
default {
$safeBranch = $branch.ToLowerInvariant() -replace '[^a-z0-9-]', '-'
$safeBranch = $safeBranch.Trim('-')
if ([string]::IsNullOrWhiteSpace($safeBranch)) { $safeBranch = 'custom' }

$channel = "dev-$safeBranch"
$tag = "templates-$safeBranch"
$title = "Krypton Templates ($branch)"
$prerelease = 'true'
}
}

$dateStamp = (Get-Date).ToUniversalTime().ToString("yyyyMMdd-HHmm")
$version = "$channel-$dateStamp"

echo "branch=$branch" >> $env:GITHUB_OUTPUT
echo "channel=$channel" >> $env:GITHUB_OUTPUT
echo "tag=$tag" >> $env:GITHUB_OUTPUT
echo "title=$title" >> $env:GITHUB_OUTPUT
echo "prerelease=$prerelease" >> $env:GITHUB_OUTPUT
echo "version=$version" >> $env:GITHUB_OUTPUT

- name: Build template zip artifacts
if: steps.templates_release_kill_switch.outputs.enabled == 'true'
id: package_templates
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'

$root = $env:GITHUB_WORKSPACE
$outputRoot = Join-Path $root "artifacts\templates"
$itemTemplateDir = Join-Path $root "Templates\ItemTemplates\KryptonForm"
$ribbonItemTemplateDir = Join-Path $root "Templates\ItemTemplates\KryptonRibbonForm"
$projectTemplateDir = Join-Path $root "Templates\ProjectTemplates\KryptonWinFormsApp"
$ribbonProjectTemplateDir = Join-Path $root "Templates\ProjectTemplates\KryptonRibbonWinFormsApp"
$readmePath = Join-Path $root "Templates\README.md"

if (-not (Test-Path $itemTemplateDir)) { throw "Missing item template directory: $itemTemplateDir" }
if (-not (Test-Path $ribbonItemTemplateDir)) { throw "Missing ribbon item template directory: $ribbonItemTemplateDir" }
if (-not (Test-Path $projectTemplateDir)) { throw "Missing project template directory: $projectTemplateDir" }
if (-not (Test-Path $ribbonProjectTemplateDir)) { throw "Missing ribbon project template directory: $ribbonProjectTemplateDir" }
if (-not (Test-Path $readmePath)) { throw "Missing templates README: $readmePath" }

New-Item -Path $outputRoot -ItemType Directory -Force | Out-Null

$prefix = "krypton-templates-${{ steps.channel.outputs.version }}"
$itemZip = Join-Path $outputRoot "$prefix-item-krypton-form.zip"
$ribbonItemZip = Join-Path $outputRoot "$prefix-item-krypton-ribbon-form.zip"
$projectZip = Join-Path $outputRoot "$prefix-project-krypton-winforms-app.zip"
$ribbonProjectZip = Join-Path $outputRoot "$prefix-project-krypton-ribbon-winforms-app.zip"
$bundleZip = Join-Path $outputRoot "$prefix-bundle.zip"

if (Test-Path $itemZip) { Remove-Item $itemZip -Force }
if (Test-Path $ribbonItemZip) { Remove-Item $ribbonItemZip -Force }
if (Test-Path $projectZip) { Remove-Item $projectZip -Force }
if (Test-Path $ribbonProjectZip) { Remove-Item $ribbonProjectZip -Force }
if (Test-Path $bundleZip) { Remove-Item $bundleZip -Force }

# These zips are shaped for Visual Studio template installation:
# each zip has the .vstemplate file at the archive root.
Compress-Archive -Path (Join-Path $itemTemplateDir '*') -DestinationPath $itemZip -CompressionLevel Optimal
Compress-Archive -Path (Join-Path $ribbonItemTemplateDir '*') -DestinationPath $ribbonItemZip -CompressionLevel Optimal
Compress-Archive -Path (Join-Path $projectTemplateDir '*') -DestinationPath $projectZip -CompressionLevel Optimal
Compress-Archive -Path (Join-Path $ribbonProjectTemplateDir '*') -DestinationPath $ribbonProjectZip -CompressionLevel Optimal
Compress-Archive -Path (Join-Path $root 'Templates\*') -DestinationPath $bundleZip -CompressionLevel Optimal

echo "output_dir=$outputRoot" >> $env:GITHUB_OUTPUT
echo "item_zip=$itemZip" >> $env:GITHUB_OUTPUT
echo "ribbon_item_zip=$ribbonItemZip" >> $env:GITHUB_OUTPUT
echo "project_zip=$projectZip" >> $env:GITHUB_OUTPUT
echo "ribbon_project_zip=$ribbonProjectZip" >> $env:GITHUB_OUTPUT
echo "bundle_zip=$bundleZip" >> $env:GITHUB_OUTPUT

- name: Upload workflow artifact
if: steps.templates_release_kill_switch.outputs.enabled == 'true'
uses: actions/upload-artifact@v4
with:
name: templates-${{ steps.channel.outputs.channel }}
path: ${{ steps.package_templates.outputs.output_dir }}/*.zip
if-no-files-found: error

- name: Publish templates to GitHub Release
if: steps.templates_release_kill_switch.outputs.enabled == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.channel.outputs.tag }}
name: ${{ steps.channel.outputs.title }}
prerelease: ${{ steps.channel.outputs.prerelease }}
make_latest: ${{ steps.channel.outputs.channel == 'stable' && 'true' || 'false' }}
body: |
Visual Studio templates for Krypton Standard Toolkit.

Included assets:
- Item template (`Krypton Form`)
- Item template (`Krypton Ribbon Form`)
- Project template (`Krypton WinForms App`)
- Project template (`Krypton Ribbon WinForms App`)
- Bundle archive with all templates and documentation

Source branch: `${{ steps.channel.outputs.branch }}`
Build stamp: `${{ steps.channel.outputs.version }}`
files: |
${{ steps.package_templates.outputs.item_zip }}
${{ steps.package_templates.outputs.ribbon_item_zip }}
${{ steps.package_templates.outputs.project_zip }}
${{ steps.package_templates.outputs.ribbon_project_zip }}
${{ steps.package_templates.outputs.bundle_zip }}
fail_on_unmatched_files: true
overwrite_files: true
1 change: 1 addition & 0 deletions Documents/Changelog/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

## 2026-11-xx - Build 2611 (V110 Nightly) - November 2026

* Implemented [#908](https://github.com/Krypton-Suite/Standard-Toolkit/issues/908), Create new items via 'New Item/Project'
* Resolved [#3283](https://github.com/Krypton-Suite/Standard-Toolkit/issues/3283), `KryptonThemeComboBox` does not change theme when `SelectedIndex` is changed
* Resolved [#3330](https://github.com/Krypton-Suite/Standard-Toolkit/issues/3330), `KryptonManager` exception 'The type initializer for 'Krypton.Toolkit.KryptonManager' threw an exception.'
* Implemented [#1673](https://github.com/Krypton-Suite/Standard-Toolkit/issues/1673), `KryptonContextMenuComboBox` & `KryptonContextMenuProgressBar` need to be implemented. `KryptonContextMenuProgressBar` for context menus (and enabled **Add ComboBox** in the context menu collection editor).
Expand Down
35 changes: 35 additions & 0 deletions Templates/ItemTemplates/KryptonForm/KryptonForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Templates/ItemTemplates/KryptonForm/KryptonForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Krypton.Toolkit;

namespace $rootnamespace$;

public partial class $safeitemrootname$ : KryptonForm
{
public $safeitemrootname$()
{
InitializeComponent();
}
}
13 changes: 13 additions & 0 deletions Templates/ItemTemplates/KryptonForm/KryptonForm.vstemplate
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>Krypton Form</Name>
<Description>Creates a Windows Form that inherits from KryptonForm.</Description>
<ProjectType>CSharp</ProjectType>
<DefaultName>KryptonForm1.cs</DefaultName>
<SortOrder>1200</SortOrder>
</TemplateData>
<TemplateContent>
<ProjectItem ReplaceParameters="true" TargetFileName="$safeitemrootname$.cs">KryptonForm.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="$safeitemrootname$.Designer.cs">KryptonForm.Designer.cs</ProjectItem>
</TemplateContent>
</VSTemplate>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions Templates/ItemTemplates/KryptonRibbonForm/KryptonRibbonForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Krypton.Toolkit;

namespace $rootnamespace$;

public partial class $safeitemrootname$ : KryptonForm
{
public $safeitemrootname$()
{
InitializeComponent();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>Krypton Ribbon Form</Name>
<Description>Creates a KryptonForm pre-configured with a KryptonRibbon control.</Description>
<ProjectType>CSharp</ProjectType>
<DefaultName>KryptonRibbonForm1.cs</DefaultName>
<SortOrder>1201</SortOrder>
</TemplateData>
<TemplateContent>
<ProjectItem ReplaceParameters="true" TargetFileName="$safeitemrootname$.cs">KryptonRibbonForm.cs</ProjectItem>
<ProjectItem ReplaceParameters="true" TargetFileName="$safeitemrootname$.Designer.cs">KryptonRibbonForm.Designer.cs</ProjectItem>
</TemplateContent>
</VSTemplate>
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net10.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Krypton.Standard.Toolkit" Version="*" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<VSTemplate Version="3.0.0" Type="Project" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005">
<TemplateData>
<Name>Krypton Ribbon WinForms App</Name>
<Description>Creates a new WinForms app configured for Krypton Toolkit with a ribbon-based main form.</Description>
<ProjectType>CSharp</ProjectType>
<DefaultName>KryptonRibbonWinFormsApp</DefaultName>
<SortOrder>1201</SortOrder>
<CreateNewFolder>true</CreateNewFolder>
<ProvideDefaultName>true</ProvideDefaultName>
</TemplateData>
<TemplateContent>
<Project File="KryptonRibbonWinFormsApp.csproj" ReplaceParameters="true" TargetFileName="$safeprojectname$.csproj">
<ProjectItem ReplaceParameters="true">Program.cs</ProjectItem>
<ProjectItem ReplaceParameters="true">MainForm.cs</ProjectItem>
<ProjectItem ReplaceParameters="true">MainForm.Designer.cs</ProjectItem>
</Project>
</TemplateContent>
</VSTemplate>
Loading
Loading