From ae6715b70b475cbce92e6f6fb2742d8ad9804a87 Mon Sep 17 00:00:00 2001 From: martincostello Date: Tue, 31 Oct 2023 18:23:28 +0000 Subject: [PATCH] Pin .NET SDK version Use the same .NET SDK version to publish NuGet packages as to build them where there is no global.json to specify it. --- .github/workflows/build.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 51e23955..1d9600b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,9 @@ jobs: name: ${{ matrix.os }} runs-on: ${{ matrix.os }} + outputs: + dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }} + strategy: fail-fast: false matrix: @@ -42,6 +45,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 + id: setup-dotnet - name: Install StatsD shell: pwsh @@ -92,6 +96,8 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 + with: + dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} - name: Validate NuGet packages shell: pwsh @@ -110,7 +116,7 @@ jobs: } publish-nuget: - needs: validate-packages + needs: [ build, validate-packages ] runs-on: ubuntu-latest if: | github.event.repository.fork == false && @@ -124,6 +130,8 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0 + with: + dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} - name: Push NuGet packages to NuGet.org run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_TOKEN }} --skip-duplicate --source https://api.nuget.org/v3/index.json