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 ee74735 commit 7fa5ae2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,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 @@ -45,6 +48,7 @@ jobs:

- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
id: setup-dotnet

- name: Build, Test and Package
shell: pwsh
Expand Down Expand Up @@ -81,6 +85,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 @@ -99,7 +105,7 @@ jobs:
}
publish-feedz-io:
needs: validate-packages
needs: [ build, validate-packages ]
runs-on: ubuntu-latest
if: |
github.event.repository.fork == false &&
Expand All @@ -119,6 +125,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 feedz.io
shell: bash
Expand All @@ -128,7 +136,7 @@ jobs:
run: dotnet nuget push "*.nupkg" --api-key "${API_KEY}" --skip-duplicate --source "${SOURCE}"

publish-nuget:
needs: validate-packages
needs: [ build, validate-packages ]
runs-on: ubuntu-latest
if: |
github.event.repository.fork == false &&
Expand All @@ -147,6 +155,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
shell: bash
Expand Down

0 comments on commit 7fa5ae2

Please sign in to comment.