diff --git a/.github/actions/nuget-cache-location/action.yml b/.github/actions/nuget-cache-location/action.yml new file mode 100644 index 0000000000..6aeea6fca1 --- /dev/null +++ b/.github/actions/nuget-cache-location/action.yml @@ -0,0 +1,14 @@ +name: NuGet cache location +description: Moves the NuGet package and HTTP caches to the runner temp drive on GitHub-hosted Windows runners +runs: + using: composite + steps: + - name: Move NuGet caches to the temp drive + if: runner.os == 'Windows' && runner.environment == 'github-hosted' + shell: pwsh + run: | + $packages = Join-Path $Env:RUNNER_TEMP 'nuget\packages' + $httpCache = Join-Path $Env:RUNNER_TEMP 'nuget\http-cache' + New-Item -ItemType Directory -Force -Path $packages, $httpCache | Out-Null + "NUGET_PACKAGES=$packages" >> $Env:GITHUB_ENV + "NUGET_HTTP_CACHE_PATH=$httpCache" >> $Env:GITHUB_ENV diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 6bdf76228d..8f4f96ecdf 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -15,6 +15,8 @@ jobs: uses: actions/checkout@v7.0.1 with: fetch-depth: 0 + - name: Move NuGet caches to the temp drive + uses: ./.github/actions/nuget-cache-location - name: Setup .NET SDK uses: actions/setup-dotnet@v6.0.0 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f9632f42a..bc181277d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,6 +57,8 @@ jobs: uses: actions/checkout@v7.0.1 with: fetch-depth: 0 + - name: Move NuGet caches to the temp drive + uses: ./.github/actions/nuget-cache-location - name: Setup .NET SDK uses: actions/setup-dotnet@v6.0.0 with: @@ -214,6 +216,8 @@ jobs: uses: actions/checkout@v7.0.1 with: fetch-depth: 0 + - name: Move NuGet caches to the temp drive + uses: ./.github/actions/nuget-cache-location - name: Setup .NET SDK uses: actions/setup-dotnet@v6.0.0 with: