diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 605f5eb..4bcb99d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -# This workflow will build a .NET project +# This workflow will build a .NET project # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net name: Build @@ -16,11 +16,12 @@ jobs: steps: - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v4 + uses: prozolic/Actions/.github/actions/setup-dotnet@main with: dotnet-version: | 8.0.x 9.0.x + 10.0.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/.github/workflows/nuget-pack-push.yml b/.github/workflows/nuget-pack-push.yml new file mode 100644 index 0000000..db4fe2a --- /dev/null +++ b/.github/workflows/nuget-pack-push.yml @@ -0,0 +1,65 @@ +name: Pack and Push NuGet Package + +on: + push: + tags: + - 'v*.*.*' # v1.1.0, v1.2.3, etc. + +jobs: + pack: + permissions: + contents: read + timeout-minutes: 10 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@71cf2267d89c5cb81562390fa70a37fa40b1305e # v6.pre.beta + - name: Setup .NET + uses: prozolic/Actions/.github/actions/setup-dotnet@main + with: + dotnet-version: | + 8.0.x + 9.0.x + 10.0.x + - name: Build + run: dotnet build -c Release + - name: Pack + run: dotnet pack -c Release -o ./publish + - uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0 + with: + name: nuget + path: ./publish/ + retention-days: 1 + if-no-files-found: error + + publish: + needs: [pack] + permissions: + contents: write + id-token: write # for NuGet Trusted Publish + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - uses: prozolic/Actions/.github/actions/setup-dotnet@main + # nuget + - name: NuGet login (OIDC → temp API key) + uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544 # v1.1.0 + id: login + with: + user: ${{ secrets.TARGET_NUGET_USER }} + - uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0 + with: + name: nuget + path: ./nuget + - name: List Nuget + run: ls -al ./nuget + - name: Create Release + shell: bash + run: gh release create ${{github.ref_name}} --title ${{github.ref_name}} --generate-notes --draft + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # upload nuget + - run: dotnet nuget push "./nuget/*.nupkg" --skip-duplicate -s https://api.nuget.org/v3/index.json -k "${NUGET_KEY}" + env: + + NUGET_KEY: ${{ steps.login.outputs.NUGET_API_KEY }} \ No newline at end of file diff --git a/CsToml.slnx b/CsToml.slnx index c89d741..f27aabb 100644 --- a/CsToml.slnx +++ b/CsToml.slnx @@ -6,7 +6,10 @@ + + + diff --git a/sandbox/Benchmark/Benchmark.csproj b/sandbox/Benchmark/Benchmark.csproj index 26df8ed..37f7b0a 100644 --- a/sandbox/Benchmark/Benchmark.csproj +++ b/sandbox/Benchmark/Benchmark.csproj @@ -2,8 +2,8 @@ Exe - net8.0;net9.0 - 13.0 + net8.0;net9.0;net10.0 + 14.0 enable enable diff --git a/sandbox/Benchmark/Config/BenchmarkConfig.cs b/sandbox/Benchmark/Config/BenchmarkConfig.cs index 43b51d3..4da66d9 100644 --- a/sandbox/Benchmark/Config/BenchmarkConfig.cs +++ b/sandbox/Benchmark/Config/BenchmarkConfig.cs @@ -10,7 +10,6 @@ namespace Benchmark; - internal class BenchmarkConfig : ManualConfig { public BenchmarkConfig() @@ -29,12 +28,12 @@ public BenchmarkConfig() AddValidator(DefaultConfig.Instance.GetValidators().ToArray()); AddLogger(ConsoleLogger.Default); - // .NET 9.0 as default. + // .NET 10.0 as default. AddJob(Job.ShortRun .WithStrategy(RunStrategy.Throughput) .DontEnforcePowerPlan() - .WithToolchain(CsProjCoreToolchain.NetCoreApp90) - .WithId($"Benchmark{CsProjCoreToolchain.NetCoreApp90.Name}")); + .WithToolchain(CsProjCoreToolchain.NetCoreApp10_0) + .WithId($"Benchmark{CsProjCoreToolchain.NetCoreApp10_0.Name}")); } public BenchmarkConfig AddTargetFramework() @@ -46,6 +45,13 @@ public BenchmarkConfig AddTargetFramework() .WithToolchain(CsProjCoreToolchain.NetCoreApp80) .WithId($"Benchmark{CsProjCoreToolchain.NetCoreApp80.Name}")); + // Add .NET 9.0 + AddJob(Job.ShortRun + .WithStrategy(RunStrategy.Throughput) + .DontEnforcePowerPlan() + .WithToolchain(CsProjCoreToolchain.NetCoreApp90) + .WithId($"Benchmark{CsProjCoreToolchain.NetCoreApp90.Name}")); + return this; } diff --git a/sandbox/Benchmark/Program.cs b/sandbox/Benchmark/Program.cs index 03320ab..769d51b 100644 --- a/sandbox/Benchmark/Program.cs +++ b/sandbox/Benchmark/Program.cs @@ -10,8 +10,8 @@ return; #else -var config = new BenchmarkConfig(); -//var config = new BenchmarkConfig().AddTargetFramework(); +//var config = new BenchmarkConfig(); +var config = new BenchmarkConfig().AddTargetFramework(); var summaries = BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config).ToArray(); if (summaries.Length == 0) { diff --git a/sandbox/ConsoleApp/ConsoleApp.csproj b/sandbox/ConsoleApp/ConsoleApp.csproj index 0e4b5cf..5b964db 100644 --- a/sandbox/ConsoleApp/ConsoleApp.csproj +++ b/sandbox/ConsoleApp/ConsoleApp.csproj @@ -2,7 +2,7 @@ Exe - net9.0 + net10.0 enable enable diff --git a/src/Directory.Build.props b/src/Directory.Build.props index f90a17f..94be213 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,7 +1,7 @@ - + - net8.0;net9.0 - 13.0 + net8.0;net9.0;net10.0 + 14.0 enable true diff --git a/tests/CsToml.Extensions.Configuration.Tests/CsToml.Extensions.Configuration.Tests.csproj b/tests/CsToml.Extensions.Configuration.Tests/CsToml.Extensions.Configuration.Tests.csproj index ec49a5a..13623c6 100644 --- a/tests/CsToml.Extensions.Configuration.Tests/CsToml.Extensions.Configuration.Tests.csproj +++ b/tests/CsToml.Extensions.Configuration.Tests/CsToml.Extensions.Configuration.Tests.csproj @@ -1,7 +1,7 @@ - net8.0;net9.0 + net8.0;net9.0;net10.0 enable enable diff --git a/tests/CsToml.Generator.Tests/CsToml.Generator.Tests.csproj b/tests/CsToml.Generator.Tests/CsToml.Generator.Tests.csproj index a23fb1d..fbf27db 100644 --- a/tests/CsToml.Generator.Tests/CsToml.Generator.Tests.csproj +++ b/tests/CsToml.Generator.Tests/CsToml.Generator.Tests.csproj @@ -1,7 +1,7 @@  - net8.0;net9.0 + net8.0;net9.0;net10.0 enable enable diff --git a/tests/CsToml.Tests/CsToml.Tests.csproj b/tests/CsToml.Tests/CsToml.Tests.csproj index af206c0..c6b2793 100644 --- a/tests/CsToml.Tests/CsToml.Tests.csproj +++ b/tests/CsToml.Tests/CsToml.Tests.csproj @@ -1,7 +1,7 @@ - net8.0;net9.0 + net8.0;net9.0;net10.0 enable enable