Skip to content

Commit fdea79d

Browse files
committed
ci: always run setup-dotnet, run it earlier, and let it handle caching
1 parent ffce6ef commit fdea79d

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,22 @@ jobs:
4646
runs-on: ${{matrix.os}}
4747
steps:
4848
- uses: actions/checkout@v4
49-
- uses: actions/cache@v4
50-
id: cache
49+
50+
- name: Check .NET versions available
51+
shell: bash
52+
run: |
53+
echo "DOTNET_VERSION_LIST<<EOF" >> $GITHUB_ENV
54+
dotnet --list-sdks >> $GITHUB_ENV
55+
echo "EOF" >> $GITHUB_ENV
56+
dotnet --list-sdks
57+
58+
- name: Setup .NET 6,8
59+
uses: actions/setup-dotnet@v4
5160
with:
52-
path: ~/.nuget/packages
53-
key: ${{ runner.os }}-nuget-breaker3-${{ hashFiles('**/packages.lock.json') }}
54-
if: matrix.cache_dependencies
61+
cache: ${{ matrix.cache_dependencies }}
62+
dotnet-version: |
63+
6.x
64+
8.x
5565
5666
- uses: nowsprinting/check-version-format-action@v4
5767
id: version
@@ -84,20 +94,7 @@ jobs:
8494
echo Set HOST_ZIP_FILE to ${{ env.HOST_ZIP_FILE }}
8595
shell: bash
8696

87-
- name: Check .NET versions available to see if we can skip install
88-
shell: bash
89-
run: |
90-
echo "DOTNET_VERSION_LIST<<EOF" >> $GITHUB_ENV
91-
dotnet --list-sdks >> $GITHUB_ENV
92-
echo "EOF" >> $GITHUB_ENV
93-
dotnet --list-sdks
94-
95-
- name: Setup .NET 6,8
96-
uses: actions/setup-dotnet@v4
97-
if: contains(env.DOTNET_VERSION_LIST, '8.0.') == 'false' || contains(env.DOTNET_VERSION_LIST, '6.0.') == 'false'
98-
with:
99-
dotnet-version: "6\n8\n"
100-
97+
10198
- name: Clear & clean on release or cache miss
10299
run: |
103100
dotnet clean --configuration Release

0 commit comments

Comments
 (0)