Skip to content

Commit

Permalink
Avoid cloning Polly
Browse files Browse the repository at this point in the history
Avoid cloning Polly to get the .NET SDK version to use, and instead output the value from the actions/setup-dotnet step in the build job.
  • Loading branch information
martincostello committed Oct 31, 2023
1 parent 840aa18 commit 328d684
Showing 1 changed file with 13 additions and 34 deletions.
47 changes: 13 additions & 34 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
# HACK Running on Windows instead of Linux due to https://github.com/stryker-mutator/stryker-net/issues/2741
RUN_MUTATION_TESTS: ${{ matrix.os_name == 'windows' && !startsWith(github.ref, 'refs/tags/') && 'true' || 'false' }}

outputs:
dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }}

strategy:
fail-fast: false
matrix:
Expand All @@ -50,6 +53,7 @@ jobs:

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

- name: Setup NuGet cache
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
Expand Down Expand Up @@ -107,15 +111,10 @@ jobs:
with:
name: packages-windows

- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: Polly

- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
global-json-file: Polly/global.json
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }}

- name: Validate NuGet packages
shell: pwsh
Expand All @@ -134,7 +133,7 @@ jobs:
}
publish-github:
needs: validate-packages
needs: [ build, validate-packages ]
permissions:
packages: write
runs-on: ubuntu-latest
Expand All @@ -149,21 +148,16 @@ jobs:
with:
name: packages-windows

- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: Polly

- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
global-json-file: Polly/global.json
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }}

- name: Publish NuGet packages to GitHub Packages
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.GITHUB_TOKEN }} --skip-duplicate --no-symbols --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json

sign:
needs: publish-github
needs: [ build, publish-github ]
runs-on: windows-latest
if: |
github.event.repository.fork == false &&
Expand All @@ -183,15 +177,10 @@ jobs:
name: signing-config
path: signing-config

- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: Polly

- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
global-json-file: Polly/global.json
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }}

- name: Install Sign CLI tool
run: dotnet tool install --tool-path . sign --version 0.9.1-beta.23530.1
Expand Down Expand Up @@ -222,7 +211,7 @@ jobs:
if-no-files-found: error

validate-signed-packages:
needs: sign
needs: [ build, sign ]
runs-on: windows-latest
steps:

Expand All @@ -231,15 +220,10 @@ jobs:
with:
name: signed-packages

- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: Polly

- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
global-json-file: Polly/global.json
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }}

- name: Validate NuGet packages
shell: pwsh
Expand Down Expand Up @@ -328,7 +312,7 @@ jobs:
}
publish-nuget:
needs: validate-signed-packages
needs: [ build, validate-signed-packages ]
runs-on: ubuntu-latest
steps:

Expand All @@ -337,15 +321,10 @@ jobs:
with:
name: signed-packages

- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
path: Polly

- name: Setup .NET SDK
uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3.2.0
with:
global-json-file: Polly/global.json
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }}

- name: Push signed 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 328d684

Please sign in to comment.