Skip to content

Merge pull request #2600 from Krypton-Suite/alpha #3

Merge pull request #2600 from Krypton-Suite/alpha

Merge pull request #2600 from Krypton-Suite/alpha #3

# New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)

Check failure on line 1 in .github/workflows/nightly-release-test.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/nightly-release-test.yml

Invalid workflow file

(Line: 15, Col: 5): Unexpected value 'retention-days'
# Modifications by Peter Wagner (aka Wagnerp), Simon Coghlan (aka Smurf-IV), Giduac, tobitege et al. 2025 - 2025. All rights reserved.
name: Nightly Release
on:
schedule:
# Run nightly build automatically at midnight UTC every day
- cron: '0 0 * * *'
workflow_dispatch: # Allow manual triggering for testing
jobs:
nightly:
runs-on: windows-2022
retention-days: 30
# Ensure this only runs for the alpha branch, even if the workflow is in main
if: github.ref == 'refs/heads/alpha'
concurrency:
group: nightly-alpha
cancel-in-progress: true
steps:
- name: Checkout alpha branch
uses: actions/checkout@v5
with:
ref: alpha
# .NET 9 (GA)
- name: Setup .NET 9
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
# .NET 10 (Preview)
- name: Setup .NET 10 (preview)
uses: actions/setup-dotnet@v4
with:
dotnet-version: 10.0.x
dotnet-quality: preview
# global.json dynamically generate (use latest SDK available)
- name: Force .NET 10 SDK via global.json
run: |
$sdkVersion = (dotnet --list-sdks | Select-String "10.0").ToString().Split(" ")[0]
if (-not $sdkVersion) {
# Fallback to .NET 8 if .NET 10 is not available
$sdkVersion = (dotnet --list-sdks | Select-String "8.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/setup-nuget@v1.2.0
- name: Cache NuGet
uses: actions/cache@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Restore
run: dotnet restore "Source/Krypton Components/Krypton Toolkit Suite 2022 - VS2022.sln"
- name: Build Nightly
run: msbuild "Scripts/nightly.proj" /t:Build /p:Configuration=Nightly /p:Platform="Any CPU"
- name: Pack Nightly
run: msbuild "Scripts/nightly.proj" /t:Pack /p:Configuration=Nightly /p:Platform="Any CPU"
- name: Push NuGet Packages to nuget.org
id: push_nuget
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
if (-not $env:NUGET_API_KEY) {
Write-Warning "NUGET_API_KEY not set - skipping NuGet push"
echo "packages_published=false" >> $env:GITHUB_OUTPUT
exit 0
}
$packages = Get-ChildItem "Bin/Packages/Nightly/*.nupkg" -ErrorAction SilentlyContinue
$publishedAny = $false
if ($packages) {
foreach ($package in $packages) {
Write-Output "Pushing package: $($package.Name)"
try {
$output = dotnet nuget push "$($package.FullName)" --api-key $env:NUGET_API_KEY --source https://api.nuget.org/v3/index.json --skip-duplicate 2>&1 | Out-String
Write-Output $output
if ($output -notmatch "already exists" -and $output -notmatch "was not pushed") {
$publishedAny = $true
Write-Host "Package $($package.Name) was published"
} else {
Write-Host "Package $($package.Name) already exists - skipped"
}
} catch {
Write-Warning "Failed to push $($package.Name): $_"
}
}
} else {
Write-Output "No NuGet packages found to push"
}
echo "packages_published=$publishedAny" >> $env:GITHUB_OUTPUT
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}