Skip to content

Commit be491d3

Browse files
committed
.NET/CI: Propagate .NET version into global.json file
https://github.com/actions/setup-dotnet/blob/main/README.md#matrix-testing
1 parent 0685813 commit be491d3

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.github/workflows/lang-csharp-efcore.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,20 @@ jobs:
6262
uses: astral-sh/setup-uv@v7
6363

6464
- name: Set up .NET ${{ matrix.dotnet-version }}
65+
id: dotnet
6566
uses: actions/setup-dotnet@v5
6667
with:
6768
dotnet-version: ${{ matrix.dotnet-version }}
6869

70+
# Note: Unless a concrete version is specified in the `global.json` file,
71+
# the latest .NET version installed on the runner (including preinstalled
72+
# versions) will be used by default. To control this behavior, you may want
73+
# to use temporary `global.json` files.
74+
# https://github.com/actions/setup-dotnet/blob/main/README.md#matrix-testing
75+
- name: Create `global.json`
76+
run: |
77+
echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json
78+
6979
- name: Validate by-language/csharp-efcore
7080
run: |
7181
uv run --with=pueblo ngr test by-language/csharp-efcore --dotnet-version=${{ matrix.dotnet-version }}

.github/workflows/lang-csharp-npgsql.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,20 @@ jobs:
6464
uses: astral-sh/setup-uv@v7
6565

6666
- name: Set up .NET ${{ matrix.dotnet-version }}
67+
id: dotnet
6768
uses: actions/setup-dotnet@v5
6869
with:
6970
dotnet-version: ${{ matrix.dotnet-version }}
7071

72+
# Note: Unless a concrete version is specified in the `global.json` file,
73+
# the latest .NET version installed on the runner (including preinstalled
74+
# versions) will be used by default. To control this behavior, you may want
75+
# to use temporary `global.json` files.
76+
# https://github.com/actions/setup-dotnet/blob/main/README.md#matrix-testing
77+
- name: Create `global.json`
78+
run: |
79+
echo '{"sdk":{"version": "${{ steps.dotnet.outputs.dotnet-version }}"}}' > ./global.json
80+
7181
- name: Validate by-language/csharp-npgsql, Npgsql ${{ matrix.npgsql-version }}
7282
run: |
7383
uv run --with=pueblo ngr test by-language/csharp-npgsql --dotnet-version=${{ matrix.dotnet-version }} --npgsql-version=${{ matrix.npgsql-version }}

0 commit comments

Comments
 (0)