* Branch parity 07/02/2025 (#3005) #1455
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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. 2025 - 2026. All rights reserved. | |
| name: Build | |
| on: | |
| pull_request: | |
| branches: ['**'] | |
| types: [opened, synchronize, reopened] | |
| push: | |
| branches: | |
| - master | |
| - alpha | |
| - canary | |
| - gold | |
| - V105-LTS | |
| - V85-LTS | |
| paths-ignore: ['.git*', '.vscode'] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| if: github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository || github.event_name == 'workflow_dispatch') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| # .NET 9 and 10 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 9.0.x | |
| 10.0.x | |
| # global.json dynamically generate | |
| - name: Force .NET 10 SDK via global.json | |
| run: | | |
| $sdkVersion = (dotnet --list-sdks | Select-String "10.0").ToString().Split(" ")[0] | |
| Write-Output "Using SDK $sdkVersion" | |
| @" | |
| { | |
| "sdk": { | |
| "version": "$sdkVersion", | |
| "rollForward": "latestFeature" | |
| } | |
| } | |
| "@ | Out-File -Encoding utf8 global.json | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| with: | |
| msbuild-architecture: x64 | |
| - name: Setup NuGet | |
| uses: NuGet/[email protected] | |
| - name: Cache NuGet | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Populate WebView2 (latest) | |
| shell: pwsh | |
| run: | | |
| $root = $env:GITHUB_WORKSPACE | |
| if (-not $root) { $root = (Get-Location).Path } | |
| $utilProj = Join-Path $root "Source\Krypton Components\Krypton.Utilities\Krypton.Utilities.csproj" | |
| $libDir = Join-Path $root "Source\Krypton Components\Krypton.Utilities\Lib\WebView2" | |
| if (-not (Test-Path $utilProj)) { Write-Error "Project not found: $utilProj"; exit 1 } | |
| if (-not (Test-Path $libDir)) { New-Item -ItemType Directory -Path $libDir -Force } | |
| $packageId = "Microsoft.Web.WebView2" | |
| $latestVersion = $null | |
| try { | |
| $searchResponse = Invoke-RestMethod -Uri "https://azuresearch-usnc.nuget.org/query?q=$packageId&prerelease=false&semVerLevel=2.0.0&take=1" -Method Get | |
| if ($searchResponse.data -and $searchResponse.data.Count -gt 0) { $latestVersion = $searchResponse.data[0].version } | |
| } catch { | |
| try { | |
| $response = Invoke-RestMethod -Uri "https://api.nuget.org/v3-flatcontainer/$packageId/index.json" -Method Get | |
| $stableVersions = $response.versions | Where-Object { $_ -notmatch '[-]' -and $_ -match '^\d+\.\d+\.\d+$' } | |
| if ($stableVersions) { $latestVersion = $stableVersions | Sort-Object { [System.Version]$_ } -Descending | Select-Object -First 1 } | |
| } catch {} | |
| } | |
| if (-not $latestVersion) { $latestVersion = "1.0.3595.46" } | |
| Write-Host "Using WebView2 (latest): $latestVersion" | |
| dotnet add $utilProj package $packageId --version $latestVersion | |
| dotnet restore $utilProj | |
| $nugetBase = Join-Path $env:USERPROFILE ".nuget\packages\microsoft.web.webview2\$latestVersion" | |
| @("Microsoft.Web.WebView2.Core.dll","Microsoft.Web.WebView2.WinForms.dll","WebView2Loader.dll") | ForEach-Object { | |
| $f = Get-ChildItem -Path $nugetBase -Recurse -Name $_ -ErrorAction SilentlyContinue | Select-Object -First 1 | |
| if ($f) { Copy-Item (Join-Path $nugetBase $f) $libDir -Force; Write-Host "Copied $_" } | |
| } | |
| dotnet remove $utilProj package $packageId | |
| - name: Restore | |
| run: dotnet restore "Source/Krypton Components/Krypton Toolkit Suite 2022 - VS2022.slnx" | |
| - name: Build | |
| run: msbuild "Scripts/Build/nightly.proj" /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" | |
| release: | |
| runs-on: windows-latest | |
| if: github.ref == 'refs/heads/master' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') | |
| needs: build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| # .NET 9 and 10 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: | | |
| 9.0.x | |
| 10.0.x | |
| # global.json dynamically generate | |
| - name: Force .NET 10 SDK via global.json | |
| run: | | |
| $sdkVersion = (dotnet --list-sdks | Select-String "10.0").ToString().Split(" ")[0] | |
| Write-Output "Using SDK $sdkVersion" | |
| @" | |
| { | |
| "sdk": { | |
| "version": "$sdkVersion", | |
| "rollForward": "latestFeature" | |
| } | |
| } | |
| "@ | Out-File -Encoding utf8 global.json | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| with: | |
| msbuild-architecture: x64 | |
| - name: Setup NuGet | |
| uses: NuGet/[email protected] | |
| - name: Cache NuGet | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Populate WebView2 (latest) | |
| shell: pwsh | |
| run: | | |
| $root = $env:GITHUB_WORKSPACE | |
| if (-not $root) { $root = (Get-Location).Path } | |
| $utilProj = Join-Path $root "Source\Krypton Components\Krypton.Utilities\Krypton.Utilities.csproj" | |
| $libDir = Join-Path $root "Source\Krypton Components\Krypton.Utilities\Lib\WebView2" | |
| if (-not (Test-Path $utilProj)) { Write-Error "Project not found: $utilProj"; exit 1 } | |
| if (-not (Test-Path $libDir)) { New-Item -ItemType Directory -Path $libDir -Force } | |
| $packageId = "Microsoft.Web.WebView2" | |
| $latestVersion = $null | |
| try { | |
| $searchResponse = Invoke-RestMethod -Uri "https://azuresearch-usnc.nuget.org/query?q=$packageId&prerelease=false&semVerLevel=2.0.0&take=1" -Method Get | |
| if ($searchResponse.data -and $searchResponse.data.Count -gt 0) { $latestVersion = $searchResponse.data[0].version } | |
| } catch { | |
| try { | |
| $response = Invoke-RestMethod -Uri "https://api.nuget.org/v3-flatcontainer/$packageId/index.json" -Method Get | |
| $stableVersions = $response.versions | Where-Object { $_ -notmatch '[-]' -and $_ -match '^\d+\.\d+\.\d+$' } | |
| if ($stableVersions) { $latestVersion = $stableVersions | Sort-Object { [System.Version]$_ } -Descending | Select-Object -First 1 } | |
| } catch {} | |
| } | |
| if (-not $latestVersion) { $latestVersion = "1.0.3595.46" } | |
| Write-Host "Using WebView2 (latest): $latestVersion" | |
| dotnet add $utilProj package $packageId --version $latestVersion | |
| dotnet restore $utilProj | |
| $nugetBase = Join-Path $env:USERPROFILE ".nuget\packages\microsoft.web.webview2\$latestVersion" | |
| @("Microsoft.Web.WebView2.Core.dll","Microsoft.Web.WebView2.WinForms.dll","WebView2Loader.dll") | ForEach-Object { | |
| $f = Get-ChildItem -Path $nugetBase -Recurse -Name $_ -ErrorAction SilentlyContinue | Select-Object -First 1 | |
| if ($f) { Copy-Item (Join-Path $nugetBase $f) $libDir -Force; Write-Host "Copied $_" } | |
| } | |
| dotnet remove $utilProj package $packageId | |
| - name: Restore | |
| run: dotnet restore "Source/Krypton Components/Krypton Toolkit Suite 2022 - VS2022.slnx" | |
| - name: Build Release | |
| run: msbuild "Scripts/Build/build.proj" /t:Build /p:Configuration=Release /p:Platform="Any CPU" | |
| - name: Pack Release | |
| run: msbuild "Scripts/Build/build.proj" /t:Pack /p:Configuration=Release /p:Platform="Any CPU" | |
| - name: Get Version | |
| id: get_version | |
| run: | | |
| $version = (dotnet build "Source/Krypton Components/Krypton.Toolkit/Krypton.Toolkit.csproj" --no-restore --verbosity quiet | Select-String "Version" | ForEach-Object { $_.Line.Split('=')[1].Trim() }) | |
| if (-not $version) { | |
| $version = "100.25.1.1" # Fallback version | |
| } | |
| echo "version=$version" >> $env:GITHUB_OUTPUT | |
| echo "tag=v$version" >> $env:GITHUB_OUTPUT |