Skip to content

Commit

Permalink
Pin .NET SDK version
Browse files Browse the repository at this point in the history
Use the same .NET SDK version to publish NuGet packages as to build them where there is no global.json to specify it.
  • Loading branch information
martincostello committed Oct 31, 2023
1 parent 63d6a17 commit ae6715b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -110,7 +116,7 @@ jobs:
}
publish-nuget:
needs: validate-packages
needs: [ build, validate-packages ]
runs-on: ubuntu-latest
if: |
github.event.repository.fork == false &&
Expand All @@ -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

0 comments on commit ae6715b

Please sign in to comment.