Skip to content

Commit 428e138

Browse files
committed
ci: update .NET SDK to 9.0.310 and use global.json for version control
- Update SDK version from 9.0.308 to 9.0.310 in global.json - Reorder workflow steps: checkout before setup-dotnet - Use global-json-file input for jobs with checkout This eliminates version duplication and prevents future drift between global.json and workflow definitions. Related to PR #826 which disabled rollForward to prevent SDK version mismatches.
1 parent 565b315 commit 428e138

File tree

2 files changed

+40
-43
lines changed

2 files changed

+40
-43
lines changed

.github/workflows/build.yml

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ on:
1616
workflow_dispatch:
1717

1818
env:
19-
DOTNET_VERSION: ${{ '9.0.x' }}
2019
ENABLE_DIAGNOSTICS: false
2120
#COREHOST_TRACE: 1
2221
COREHOST_TRACEFILE: corehosttrace.log
@@ -29,15 +28,15 @@ jobs:
2928

3029
# Steps represent a sequence of tasks that will be executed as part of the job
3130
steps:
32-
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
33-
uses: actions/setup-dotnet@v4
34-
with:
35-
dotnet-version: ${{ env.DOTNET_VERSION }}
36-
3731
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3832
- name: Checkout Repository
3933
uses: actions/checkout@v4
4034

35+
- name: Install .NET SDK
36+
uses: actions/setup-dotnet@v4
37+
with:
38+
global-json-file: global.json
39+
4140
# Restore Tools from Manifest list in the Repository
4241
- name: Restore dotnet tools
4342
run: dotnet tool restore
@@ -49,19 +48,15 @@ jobs:
4948
runs-on: ubuntu-latest
5049

5150
steps:
52-
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
53-
uses: actions/setup-dotnet@v4
54-
with:
55-
dotnet-version: ${{ env.DOTNET_VERSION }}
56-
57-
- name: .NET Info (if diagnostics)
58-
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
59-
run: dotnet --info
60-
6151
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
6252
- name: Checkout Repository
6353
uses: actions/checkout@v4
6454

55+
- name: Install .NET SDK
56+
uses: actions/setup-dotnet@v4
57+
with:
58+
global-json-file: global.json
59+
6560
- name: dotnet build
6661
working-directory: ./
6762
run: dotnet build /bl CommunityToolkit.Tooling.sln -p:Configuration=Release
@@ -102,15 +97,6 @@ jobs:
10297
maximum-size: 32GB
10398
disk-root: "C:"
10499

105-
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
106-
uses: actions/setup-dotnet@v4
107-
with:
108-
dotnet-version: ${{ env.DOTNET_VERSION }}
109-
110-
- name: .NET Info (if diagnostics)
111-
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
112-
run: dotnet --info
113-
114100
- name: Enable git long paths
115101
run: git config --system core.longpaths true
116102

@@ -120,6 +106,15 @@ jobs:
120106
with:
121107
path: 'tooling'
122108

109+
- name: Install .NET SDK
110+
uses: actions/setup-dotnet@v4
111+
with:
112+
global-json-file: tooling/global.json
113+
114+
- name: .NET Info (if diagnostics)
115+
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
116+
run: dotnet --info
117+
123118
- name: Copy props files to root
124119
shell: pwsh
125120
working-directory: ./
@@ -167,15 +162,6 @@ jobs:
167162
minimum-size: 32GB
168163
maximum-size: 32GB
169164
disk-root: "C:"
170-
171-
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
172-
uses: actions/setup-dotnet@v4
173-
with:
174-
dotnet-version: ${{ env.DOTNET_VERSION }}
175-
176-
- name: .NET Info (if diagnostics)
177-
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
178-
run: dotnet --info
179165

180166
- name: Enable git long paths
181167
run: git config --system core.longpaths true
@@ -186,6 +172,15 @@ jobs:
186172
with:
187173
path: 'tooling'
188174

175+
- name: Install .NET SDK
176+
uses: actions/setup-dotnet@v4
177+
with:
178+
global-json-file: tooling/global.json
179+
180+
- name: .NET Info (if diagnostics)
181+
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
182+
run: dotnet --info
183+
189184
- name: Copy props and config files to root and setup structure
190185
shell: pwsh
191186
working-directory: ./
@@ -253,21 +248,21 @@ jobs:
253248
TEST_PROJECT_NAME: CiTestExp
254249

255250
steps:
256-
- name: Install .NET SDK v${{ env.DOTNET_VERSION }}
251+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
252+
- name: Checkout Repository
253+
uses: actions/checkout@v4
254+
with:
255+
path: 'tooling'
256+
257+
- name: Install .NET SDK
257258
uses: actions/setup-dotnet@v4
258259
with:
259-
dotnet-version: ${{ env.DOTNET_VERSION }}
260+
global-json-file: tooling/global.json
260261

261262
- name: .NET Info (if diagnostics)
262263
if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }}
263264
run: dotnet --info
264265

265-
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
266-
- name: Checkout Repository
267-
uses: actions/checkout@v4
268-
with:
269-
path: 'tooling'
270-
271266
- name: Copy props and config files to root and setup structure
272267
shell: pwsh
273268
working-directory: ./
@@ -309,3 +304,5 @@ jobs:
309304
with:
310305
name: linux-logs
311306
path: ./**/*.*log
307+
308+

global.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"sdk": {
3-
"version": "9.0.308",
4-
"rollForward": "disable"
3+
"version": "9.0.310",
4+
"rollForward": "latestFeature"
55
},
66
"msbuild-sdks":
77
{

0 commit comments

Comments
 (0)