Skip to content

Commit c4003e6

Browse files
authored
chore: Install .NET in sdk.yml for version 3 (#2372)
1 parent 3d34ab5 commit c4003e6

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

.github/workflows/sdk.yml

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,16 +87,39 @@ jobs:
8787
run: |
8888
apt-get update
8989
apt-get install -y zlib1g-dev libcurl4-openssl-dev libssl-dev build-essential cmake curl
90-
set -eo pipefail
91-
curl -sSL --retry 5 https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 9.0 --install-dir /usr/share/dotnet
92-
echo "/usr/share/dotnet" >> $GITHUB_PATH
9390
env:
9491
DEBIAN_FRONTEND: noninteractive
9592

93+
- name: Install .NET SDK (Linux/Android)
94+
if: ${{ runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' }}
95+
shell: bash
96+
run: |
97+
set -eo pipefail
98+
DOTNET_VERSION=$(grep -A 1 '"sdk":' global.json | grep '"version":' | sed 's/.*"version": *"\(.*\)".*/\1/')
99+
curl -sSL --retry 5 https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version $DOTNET_VERSION --install-dir /usr/share/dotnet
100+
echo "/usr/share/dotnet" >> $GITHUB_PATH
101+
102+
- name: Install .NET SDK (macOS)
103+
if: ${{ runner.os == 'macOS' && steps.cache.outputs.cache-hit != 'true' }}
104+
shell: bash
105+
run: |
106+
DOTNET_VERSION=$(grep -A 1 '"sdk":' global.json | grep '"version":' | sed 's/.*"version": *"\(.*\)".*/\1/')
107+
curl -sSL --retry 5 https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version $DOTNET_VERSION --install-dir $HOME/.dotnet
108+
echo "$HOME/.dotnet" >> $GITHUB_PATH
109+
110+
- name: Install .NET SDK (Windows)
111+
if: ${{ runner.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' }}
112+
shell: pwsh
113+
run: |
114+
$dotnetVersion = (Get-Content global.json | ConvertFrom-Json).sdk.version
115+
Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile "dotnet-install.ps1"
116+
.\dotnet-install.ps1 -Version $dotnetVersion -InstallDir "$env:ProgramFiles\dotnet"
117+
96118
- name: Build
97119
if: steps.cache.outputs.cache-hit != 'true'
98120
run: |
99121
git submodule update --init --recursive ${{ steps.env.outputs.submodules }}
122+
dotnet workload restore
100123
dotnet msbuild /t:Build${{ env.TARGET }}SDK /p:Configuration=Release /p:OutDir=other src/Sentry.Unity
101124
102125
- name: Upload build logs on failure

0 commit comments

Comments
 (0)