Skip to content

Commit

Permalink
Patch global.json to 7.0.100 for macOS
Browse files Browse the repository at this point in the history
  - `dotnet format` is broken on macOS with .NET SDK 7.0.101 (mimicking craigktreasure/Treasure.Utils#31). So, we're installing 7.0.100 in addition to the latest and patching the `global.json` file at build time on macOS to prevent rolling forward to the latest SDK version. This means we'll use the latest on Windows and Linux, but macOS will be pinned o 7.0.100 for now until it's fixed.
  • Loading branch information
craigktreasure committed Dec 21, 2022
1 parent 2504ba5 commit 0fe9da9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 23 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,18 @@ jobs:
with:
fetch-depth: 0

- name: Setup .NET 3.1.x SDK
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x
dotnet-version: |
3.1.x
6.x
7.0.100
7.x
- name: Setup .NET 6.x SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.x

- name: Setup .NET 7.x SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
- name: Patch global.json if necessary
shell: pwsh
run: ./scripts/PatchGlobalJson.ps1

- name: Install dependencies
run: dotnet restore
Expand Down
22 changes: 10 additions & 12 deletions .github/workflows/PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@ jobs:
with:
fetch-depth: 0

- name: Setup .NET 3.1.x SDK
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.x

- name: Setup .NET 6.x SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.x

- name: Setup .NET 7.x SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.x
dotnet-version: |
3.1.x
6.x
7.0.100
7.x
- name: Patch global.json if necessary
shell: pwsh
run: ./scripts/PatchGlobalJson.ps1

- name: Install dependencies
run: dotnet restore
Expand Down
9 changes: 9 additions & 0 deletions scripts/PatchGlobalJson.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
if (-not $IsMacOS) {
return
}

Write-Host 'Disabling rollForward to pin to version in global.json.'
$globalJsonPath = Join-Path $PSScriptRoot '../global.json'
$globalJson = Get-Content $globalJsonPath -Raw | ConvertFrom-Json
$globalJson.sdk.rollForward = 'disable'
$globalJson | ConvertTo-Json | Set-Content -Path $globalJsonPath

0 comments on commit 0fe9da9

Please sign in to comment.