diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index 0a0333f2..73f63862 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,48 +1,55 @@ -name: .NET Build, Test, and Publish Nuget Package +name: .NET Build, Test, and Publish NuGet Package on: push: branches: - "**" - tags: + tags: - "v[0-9]+.[0-9]+.[0-9]+" pull_request: branches: - "**" + permissions: contents: read packages: write + env: VERSION: 0.0.0 -defaults: - run: - working-directory: ./ - jobs: - build: + build-test-and-publish: runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 + - name: Set Version Variable if: ${{ github.ref_type == 'tag' }} env: TAG: ${{ github.ref_name }} run: echo "VERSION=${TAG#v}" >> $GITHUB_ENV - - name: Setup .NET - uses: actions/setup-dotnet@v2 + + - name: Setup .NET 10 SDK + uses: actions/setup-dotnet@v4 with: - dotnet-version: | - 10.0.x - 8.0.x - - name: Restore dependencies + dotnet-version: '10.0.x' + dotnet-quality: 'preview' + + - name: Restore run: dotnet restore - - name: Build - run: dotnet build --configuration Release --no-restore --verbosity normal /p:Version=$VERSION - - name: Test - run: dotnet test --configuration Release --no-build --verbosity normal - - name: pack nuget packages - run: dotnet pack --configuration Release --output nupkgs --no-restore --no-build --verbosity normal /p:PackageVersion=$VERSION - - name: upload nuget package - if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') - run: dotnet nuget push nupkgs/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json + + - name: Build (net8.0 + net10.0) + run: dotnet build -c Release --no-restore /p:Version=$VERSION + + - name: Test (all TFMs) + run: dotnet test -c Release --no-build + + - name: Pack & Publish + if: ${{ github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v') }} + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: | + dotnet pack -c Release --no-build -o nupkgs /p:PackageVersion=$VERSION + dotnet nuget push nupkgs/*.nupkg -k $NUGET_API_KEY -s https://api.nuget.org/v3/index.json + diff --git a/DynamoDBGenerator.sln b/DynamoDBGenerator.sln index dfaa95fe..636c78f4 100644 --- a/DynamoDBGenerator.sln +++ b/DynamoDBGenerator.sln @@ -1,4 +1,3 @@ - Microsoft Visual Studio Solution File, Format Version 12.00 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DynamoDBGenerator.SourceGenerator", "src\DynamoDBGenerator.SourceGenerator\DynamoDBGenerator.SourceGenerator.csproj", "{648B1DF4-9684-4422-95F5-74BB89862E4D}" EndProject diff --git a/samples/Configuration/Configuration.csproj b/samples/Configuration/Configuration.csproj index bc964bb8..be8305e6 100644 --- a/samples/Configuration/Configuration.csproj +++ b/samples/Configuration/Configuration.csproj @@ -2,12 +2,18 @@ Exe - net10.0 enable enable false - + + + net8.0 + + + net8.0;net10.0 + + diff --git a/samples/Initialisation/Initialisation.csproj b/samples/Initialisation/Initialisation.csproj index e8eae7f7..be8305e6 100644 --- a/samples/Initialisation/Initialisation.csproj +++ b/samples/Initialisation/Initialisation.csproj @@ -2,12 +2,18 @@ Exe - net10.0 enable enable false + + net8.0 + + + net8.0;net10.0 + + diff --git a/samples/KeyConversion/KeyConversion.csproj b/samples/KeyConversion/KeyConversion.csproj index bc964bb8..c6f809f9 100644 --- a/samples/KeyConversion/KeyConversion.csproj +++ b/samples/KeyConversion/KeyConversion.csproj @@ -2,11 +2,16 @@ Exe - net10.0 enable enable false + + net8.0 + + + net8.0;net10.0 + diff --git a/samples/RequestAndResponseObjects/RequestAndResponseObjects.csproj b/samples/RequestAndResponseObjects/RequestAndResponseObjects.csproj index bc964bb8..c6f809f9 100644 --- a/samples/RequestAndResponseObjects/RequestAndResponseObjects.csproj +++ b/samples/RequestAndResponseObjects/RequestAndResponseObjects.csproj @@ -2,11 +2,16 @@ Exe - net10.0 enable enable false + + net8.0 + + + net8.0;net10.0 + diff --git a/samples/TypeSupport/TypeSupport.csproj b/samples/TypeSupport/TypeSupport.csproj index 19f85310..a065a7d1 100644 --- a/samples/TypeSupport/TypeSupport.csproj +++ b/samples/TypeSupport/TypeSupport.csproj @@ -2,10 +2,15 @@ Exe - net10.0 enable enable + + net8.0 + + + net8.0;net10.0 + diff --git a/src/DynamoDBGenerator.SourceGenerator/DynamoDBGenerator.SourceGenerator.csproj b/src/DynamoDBGenerator.SourceGenerator/DynamoDBGenerator.SourceGenerator.csproj index a3a56928..2e67d760 100644 --- a/src/DynamoDBGenerator.SourceGenerator/DynamoDBGenerator.SourceGenerator.csproj +++ b/src/DynamoDBGenerator.SourceGenerator/DynamoDBGenerator.SourceGenerator.csproj @@ -20,8 +20,16 @@ true - - + + + + + + @@ -29,5 +37,4 @@ - diff --git a/src/DynamoDBGenerator/DynamoDBGenerator.csproj b/src/DynamoDBGenerator/DynamoDBGenerator.csproj index 04b4e044..a2664ab4 100644 --- a/src/DynamoDBGenerator/DynamoDBGenerator.csproj +++ b/src/DynamoDBGenerator/DynamoDBGenerator.csproj @@ -1,7 +1,6 @@ - net10.0;net8.0 enable true 0.0.0 @@ -16,6 +15,12 @@ true true + + net8.0 + + + net8.0;net10.0 + diff --git a/tests/DynamoDBGenerator.SourceGenerator.Benchmarks/DynamoDBGenerator.SourceGenerator.Benchmarks.csproj b/tests/DynamoDBGenerator.SourceGenerator.Benchmarks/DynamoDBGenerator.SourceGenerator.Benchmarks.csproj index 114ffa1a..5c7ffb2b 100644 --- a/tests/DynamoDBGenerator.SourceGenerator.Benchmarks/DynamoDBGenerator.SourceGenerator.Benchmarks.csproj +++ b/tests/DynamoDBGenerator.SourceGenerator.Benchmarks/DynamoDBGenerator.SourceGenerator.Benchmarks.csproj @@ -2,11 +2,16 @@ Exe - net10.0 enable enable false + + net8.0 + + + net8.0;net10.0 + diff --git a/tests/DynamoDBGenerator.SourceGenerator.Tests/DynamoDBGenerator.SourceGenerator.Tests.csproj b/tests/DynamoDBGenerator.SourceGenerator.Tests/DynamoDBGenerator.SourceGenerator.Tests.csproj index db57dcb5..cce22e1e 100644 --- a/tests/DynamoDBGenerator.SourceGenerator.Tests/DynamoDBGenerator.SourceGenerator.Tests.csproj +++ b/tests/DynamoDBGenerator.SourceGenerator.Tests/DynamoDBGenerator.SourceGenerator.Tests.csproj @@ -1,13 +1,18 @@ - net10.0;net8.0 enable enable false true false + + net8.0 + + + net8.0;net10.0 +