Compare commits

..

7 Commits

Author SHA1 Message Date
v-mahabaleshwars
84bc3a3451 Add support for installing .NET runtimes alongside SDKs (#806)
* Add support for installing .NET runtimes alongside SDKs

* Add tests for preview runtime pairing and fallback logic in installer
2026-11-20 08:13:57 -06:00
Haritha
0f4a354dd5 Prepare v6.1.0 release with updated cache dependency (#798)
Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-02 20:39:43 -06:00
Priya Gupta
6ec5c6b286 Add fallback install directory when default is not writable (#785)
* Add fallback install directory when default is not writable

* Refactor macOS install directory handling to warn when default is not writable
2026-10-30 08:13:43 -05:00
dependabot[bot]
62573f4b60 Bump brace-expansion (#790)
* Bump brace-expansion

Bumps  and [brace-expansion](https://github.com/juliangruber/brace-expansion). These dependencies needed to be updated together.

Updates `brace-expansion` from 1.1.18 to 1.1.21
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/v1.1.18...v1.1.21)

Updates `brace-expansion` from 5.0.9 to 5.0.12
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/v1.1.18...v1.1.21)

Updates `brace-expansion` from 2.1.4 to 2.1.7
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](https://github.com/juliangruber/brace-expansion/compare/v1.1.18...v1.1.21)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.21
  dependency-type: indirect
- dependency-name: brace-expansion
  dependency-version: 5.0.12
  dependency-type: indirect
- dependency-name: brace-expansion
  dependency-version: 2.1.7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix license failures

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
2026-10-27 11:40:29 -05:00
dependabot[bot]
67290a9d23 Bump handlebars from 4.7.9 to 4.7.10 (#792)
Bumps [handlebars](https://github.com/handlebars-lang/handlebars.js) from 4.7.9 to 4.7.10.
- [Release notes](https://github.com/handlebars-lang/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/v4.7.10/release-notes.md)
- [Commits](https://github.com/handlebars-lang/handlebars.js/compare/v4.7.9...v4.7.10)

---
updated-dependencies:
- dependency-name: handlebars
  dependency-version: 4.7.10
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-27 11:34:40 -05:00
dependabot[bot]
0072421cf6 Bump actions/checkout from 7.0.0 to 7.0.1 (#788)
Bumps [actions/checkout](https://github.com/actions/checkout) from 7.0.0 to 7.0.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v7...3d3c42e5aac5ba805825da76410c181273ba90b1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 7.0.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-10-27 11:23:00 -05:00
dependabot[bot]
9ead3175a9 Bump undici from 6.28.0 to 6.29.1 (#784)
* Bump undici from 6.28.0 to 6.29.1

Bumps [undici](https://github.com/nodejs/undici) from 6.28.0 to 6.29.1.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v6.28.0...v6.29.1)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 6.29.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix license failures

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
2026-10-27 11:18:06 -05:00
37 changed files with 11519 additions and 9634 deletions

View File

@@ -12,6 +12,32 @@ on:
- '**.md' - '**.md'
jobs: jobs:
test-runtime-only:
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Clear toolcache
shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
- name: Setup dotnet runtime 8.0.11
uses: ./
with:
dotnet-runtime: 8.0.11
- name: Verify dotnet runtimes
shell: pwsh
run: |
$runtimes = dotnet --list-runtimes
foreach ($runtime in 'Microsoft.NETCore.App', 'Microsoft.AspNetCore.App') {
if (-not ($runtimes -like "$runtime 8.0.11 *")) {
throw "$runtime 8.0.11 was not installed."
}
}
test-setup-multiple-versions: test-setup-multiple-versions:
runs-on: ${{ matrix.operating-system }} runs-on: ${{ matrix.operating-system }}
strategy: strategy:
@@ -747,7 +773,7 @@ jobs:
operating-system: [ubuntu-latest, windows-latest, macos-latest] operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Clear toolcache - name: Clear toolcache
shell: pwsh shell: pwsh
run: __tests__/clear-toolcache.ps1 ${{ runner.os }} run: __tests__/clear-toolcache.ps1 ${{ runner.os }}

View File

@@ -10,7 +10,7 @@ allowed:
- mit - mit
- cc0-1.0 - cc0-1.0
- unlicense - unlicense
- blueoak-1.0.0 - BlueOak-1.0.0
reviewed: reviewed:
npm: npm:

View File

@@ -1,6 +1,6 @@
--- ---
name: "@actions/cache" name: "@actions/cache"
version: 6.2.0 version: 6.3.0
type: npm type: npm
summary: Actions cache lib summary: Actions cache lib
homepage: https://github.com/actions/toolkit/tree/main/packages/cache homepage: https://github.com/actions/toolkit/tree/main/packages/cache

View File

@@ -1,20 +0,0 @@
---
name: "@actions/glob"
version: 0.6.1
type: npm
summary: Actions glob lib
homepage: https://github.com/actions/toolkit/tree/main/packages/glob
license: mit
licenses:
- sources: LICENSE.md
text: |-
The MIT License (MIT)
Copyright 2019 GitHub
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
notices: []

View File

@@ -1,6 +1,6 @@
--- ---
name: "@azure/abort-controller" name: "@azure/abort-controller"
version: 2.1.2 version: 2.2.0
type: npm type: npm
summary: Microsoft Azure SDK for JavaScript - Aborter summary: Microsoft Azure SDK for JavaScript - Aborter
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/abort-controller/README.md
@@ -8,9 +8,9 @@ license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE
text: | text: |
The MIT License (MIT) Copyright (c) Microsoft Corporation.
Copyright (c) 2020 Microsoft MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -22,7 +22,7 @@ licenses:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

View File

@@ -1,10 +1,10 @@
--- ---
name: "@azure/core-auth" name: "@azure/core-auth"
version: 1.10.1 version: 1.11.0
type: npm type: npm
summary: Provides low-level interfaces and helper methods for authentication in Azure summary: Provides low-level interfaces and helper methods for authentication in Azure
SDK SDK
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-auth/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-auth/README.md
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

@@ -1,6 +1,6 @@
--- ---
name: "@azure/core-client" name: "@azure/core-client"
version: 1.10.2 version: 1.11.1
type: npm type: npm
summary: Core library for interfacing with AutoRest generated code summary: Core library for interfacing with AutoRest generated code
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-client/ homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-client/

View File

@@ -1,9 +1,9 @@
--- ---
name: "@azure/core-http-compat" name: "@azure/core-http-compat"
version: 2.4.0 version: 2.5.0
type: npm type: npm
summary: Core HTTP Compatibility Library to bridge the gap between Core V1 & V2 packages. summary: Core HTTP Compatibility Library to bridge the gap between Core V1 & V2 packages.
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-compat/ homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-http-compat/
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

@@ -1,6 +1,6 @@
--- ---
name: "@azure/core-paging" name: "@azure/core-paging"
version: 1.6.2 version: 1.7.0
type: npm type: npm
summary: Core types for paging async iterable iterators summary: Core types for paging async iterable iterators
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-paging/README.md
@@ -8,9 +8,9 @@ license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE
text: | text: |
The MIT License (MIT) Copyright (c) Microsoft Corporation.
Copyright (c) 2020 Microsoft MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@@ -22,7 +22,7 @@ licenses:
The above copyright notice and this permission notice shall be included in all The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software. copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

View File

@@ -0,0 +1,32 @@
---
name: "@azure/core-rest-pipeline"
version: 1.23.0
type: npm
summary: Isomorphic client library for making HTTP requests in node.js and browser.
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-rest-pipeline/
license: mit
licenses:
- sources: LICENSE
text: |
Copyright (c) Microsoft Corporation.
MIT License
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []

View File

@@ -1,6 +1,6 @@
--- ---
name: "@azure/core-rest-pipeline" name: "@azure/core-rest-pipeline"
version: 1.24.0 version: 1.25.0
type: npm type: npm
summary: Isomorphic client library for making HTTP requests in node.js and browser. summary: Isomorphic client library for making HTTP requests in node.js and browser.
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-rest-pipeline/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-rest-pipeline/README.md

View File

@@ -1,6 +1,6 @@
--- ---
name: "@azure/core-tracing" name: "@azure/core-tracing"
version: 1.3.1 version: 1.4.0
type: npm type: npm
summary: Provides low-level interfaces and helper methods for tracing in Azure SDK summary: Provides low-level interfaces and helper methods for tracing in Azure SDK
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-tracing/README.md homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-tracing/README.md

View File

@@ -1,6 +1,6 @@
--- ---
name: "@azure/core-util" name: "@azure/core-util"
version: 1.13.1 version: 1.14.0
type: npm type: npm
summary: Core library for shared utility methods summary: Core library for shared utility methods
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-util/ homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-util/

View File

@@ -1,9 +1,9 @@
--- ---
name: "@azure/core-xml" name: "@azure/core-xml"
version: 1.5.1 version: 1.6.0
type: npm type: npm
summary: Core library for interacting with XML payloads summary: Core library for interacting with XML payloads
homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/core/core-xml/ homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/core-xml/README.md
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

@@ -1,6 +1,6 @@
--- ---
name: "@azure/logger" name: "@azure/logger"
version: 1.3.0 version: 1.4.0
type: npm type: npm
summary: Microsoft Azure SDK for JavaScript - Logger summary: Microsoft Azure SDK for JavaScript - Logger
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger/README.md

View File

@@ -1,9 +1,9 @@
--- ---
name: "@azure/storage-blob" name: "@azure/storage-blob"
version: 12.32.0 version: 12.31.0
type: npm type: npm
summary: Microsoft Azure Storage SDK for JavaScript - Blob summary: Microsoft Azure Storage SDK for JavaScript - Blob
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-blob/README.md homepage: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/storage/storage-blob/
license: mit license: mit
licenses: licenses:
- sources: LICENSE - sources: LICENSE

View File

@@ -1,6 +1,6 @@
--- ---
name: "@azure/storage-common" name: "@azure/storage-common"
version: 12.4.1 version: 12.5.0
type: npm type: npm
summary: Azure Storage Common Client Library for JavaScript summary: Azure Storage Common Client Library for JavaScript
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-common/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/storage/storage-common/README.md

View File

@@ -1,6 +1,6 @@
--- ---
name: "@typespec/ts-http-runtime" name: "@typespec/ts-http-runtime"
version: 0.3.6 version: 0.3.9
type: npm type: npm
summary: Isomorphic client library for making HTTP requests in node.js and browser. summary: Isomorphic client library for making HTTP requests in node.js and browser.
homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/ts-http-runtime/README.md homepage: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/ts-http-runtime/README.md

View File

@@ -1,55 +0,0 @@
---
name: balanced-match
version: 1.0.2
type: npm
summary: Match balanced character pairs, like "{" and "}"
homepage: https://github.com/juliangruber/balanced-match
license: mit
licenses:
- sources: LICENSE.md
text: |
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- sources: README.md
text: |-
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []

View File

@@ -1,55 +0,0 @@
---
name: brace-expansion
version: 1.1.18
type: npm
summary: Brace expansion as known from sh/bash
homepage: https://github.com/juliangruber/brace-expansion
license: mit
licenses:
- sources: LICENSE
text: |
MIT License
Copyright (c) 2013 Julian Gruber <julian@juliangruber.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- sources: README.md
text: |-
(MIT)
Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
notices: []

View File

@@ -1,6 +1,6 @@
--- ---
name: brace-expansion name: brace-expansion
version: 5.0.9 version: 5.0.12
type: npm type: npm
summary: Brace expansion as known from sh/bash summary: Brace expansion as known from sh/bash
homepage: homepage:

View File

@@ -1,31 +0,0 @@
---
name: concat-map
version: 0.0.1
type: npm
summary: concatenative mapdashery
homepage:
license: other
licenses:
- sources: LICENSE
text: |
This software is released under the MIT license:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- sources: README.markdown
text: MIT
notices: []

View File

@@ -1,26 +0,0 @@
---
name: minimatch
version: 3.1.5
type: npm
summary: a glob matcher in javascript
homepage:
license: isc
licenses:
- sources: LICENSE
text: |
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
notices: []

View File

@@ -4,7 +4,7 @@ version: 10.2.5
type: npm type: npm
summary: a glob matcher in javascript summary: a glob matcher in javascript
homepage: homepage:
license: blueoak-1.0.0 license: BlueOak-1.0.0
licenses: licenses:
- sources: LICENSE.md - sources: LICENSE.md
text: | text: |

View File

@@ -1,6 +1,6 @@
--- ---
name: undici name: undici
version: 6.28.0 version: 6.29.1
type: npm type: npm
summary: An HTTP/1.1 client, written from scratch for Node.js summary: An HTTP/1.1 client, written from scratch for Node.js
homepage: https://undici.nodejs.org homepage: https://undici.nodejs.org

View File

@@ -53,15 +53,41 @@ steps:
9.0.x 9.0.x
- run: dotnet build <my project> - run: dotnet build <my project>
``` ```
## Installing additional runtimes
The `dotnet-runtime` input allows you to install .NET runtimes separately from SDKs. This is useful for multi-targeting scenarios where you need one SDK version but multiple runtime versions.
When `dotnet-runtime` is specified, both the .NET Runtime (Microsoft.NETCore.App) and the ASP.NET Core Runtime (Microsoft.AspNetCore.App) are installed for each specified version. Before .NET Core 2.1, only the base runtime is installed.
For exact preview/RC versions, release metadata selects the matching ASP.NET Core build. If the mapping is unavailable, the action warns and tries the same exact version; installer failures remain fatal. `dotnet-quality` continues to apply to both SDKs and runtimes.
`dotnet-runtime` doesn't change how the SDK is selected, so it doesn't suppress the SDK installation from `global.json`. For example, if only `dotnet-runtime` is set and the repository root contains a `global.json` file, the SDK version specified in that file is installed as well, and the `dotnet-version` output contains that SDK version.
**Example: Install SDK 10 with runtimes 8 and 9**:
```yml
steps:
- uses: actions/checkout@v7
- name: Setup dotnet
uses: actions/setup-dotnet@v6
with:
dotnet-version: '10.0.x'
dotnet-runtime: |
8.0.x
9.0.x
- run: dotnet build <my project>
- run: dotnet test <my project>
```
## Supported version syntax ## Supported version syntax
The `dotnet-version` input supports following syntax: The `dotnet-version` and `dotnet-runtime` inputs support the following syntax:
- **A.B.C** (e.g 9.0.308, 10.0.100-preview.1.25120.13) - installs exact version of .NET SDK - **A.B.C** (e.g 9.0.308 for an SDK, 9.0.9 for a runtime, 10.0.100-preview.1.25120.13) - installs exact version of .NET SDK or runtime
- **A.B** or **A.B.x** (e.g. 8.0, 8.0.x) - installs the latest patch version of .NET SDK on the channel `8.0`, including prerelease versions (preview, rc) - **A.B** or **A.B.x** (e.g. 8.0, 8.0.x) - installs the latest patch version on the channel `8.0`, including prerelease versions (preview, rc)
- **A** or **A.x** (e.g. 8, 8.x) - installs the latest minor version of the specified major tag, including prerelease versions (preview, rc) - **A** or **A.x** (e.g. 8, 8.x) - installs the latest minor version of the specified major tag, including prerelease versions (preview, rc)
- **A.B.Cxx** (e.g. 8.0.4xx) - available since `.NET 5.0` release. Installs the latest version of the specific SDK release, including prerelease versions (preview, rc). - **A.B.Cxx** (e.g. 8.0.4xx) - `dotnet-version` only, available since `.NET 5.0` release. Installs the latest version of the specific SDK feature band, including prerelease versions (preview, rc). Feature bands apply only to SDKs, so `dotnet-runtime` rejects this syntax; use **A.B** or **A.B.x** (e.g. 8.0.x) for the latest runtime patch instead.
- **latest** - dynamically resolves to the highest active .NET SDK version. By default, it installs the latest **stable (GA)** version (excluding previews and end-of-life releases). Can be combined with `dotnet-channel` and `dotnet-quality`. - **latest** - dynamically resolves to the highest active .NET version. By default, it installs the latest **stable (GA)** version (excluding previews and end-of-life releases). For both `dotnet-version` and `dotnet-runtime`, it can be combined with `dotnet-channel` and `dotnet-quality`.
## Using with `dotnet-channel` input ## Using with `dotnet-channel` input
@@ -74,7 +100,7 @@ The optional `dotnet-channel` input specifies the source channel for the install
| `A.B` (e.g. `8.0`) | A specific release channel | | `A.B` (e.g. `8.0`) | A specific release channel |
| `A.B.Cxx` (e.g. `8.0.1xx`) | A specific SDK release (available since 5.0) | | `A.B.Cxx` (e.g. `8.0.1xx`) | A specific SDK release (available since 5.0) |
> **Note**: The `dotnet-channel` input is only applied when `dotnet-version` is set to `latest`. If used with a specific version, a warning will be logged and the channel input will be ignored. > **Note**: The `dotnet-channel` input applies to `latest` entries in `dotnet-version` or `dotnet-runtime`; otherwise it is ignored with a warning. For `dotnet-runtime`, an `A.B.Cxx` channel uses its `A.B` channel (e.g. `8.0.1xx` installs the latest `8.0` runtime), without affecting SDK installation.
**Install latest LTS version:** **Install latest LTS version:**
```yaml ```yaml
@@ -327,7 +353,7 @@ The `workloads` input allows you to install .NET workloads as part of the SDK se
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v7
- name: Setup .NET with workloads - name: Setup .NET with workloads
uses: actions/setup-dotnet@v6 uses: actions/setup-dotnet@v6
with: with:
@@ -357,6 +383,8 @@ An installed SDK is reused only when it matches the requested spec (`A.B.C`, `A.
When the request comes from `global.json`, the SDK is picked the way the .NET resolver picks one: `latestPatch`, `latestFeature`, `latestMinor` and `latestMajor` take the **highest** SDK the policy allows, while `feature`, `minor` and `major` roll forward to the **nearest** higher feature band, minor or major and then take its latest patch. `patch` — the default when `rollForward` is omitted — prefers the declared version, otherwise the latest patch in its band. `disable` and a prerelease `sdk.version` require an exact match, and `allowPrerelease` is not used: `dotnet-quality` is the only prerelease control. When the request comes from `global.json`, the SDK is picked the way the .NET resolver picks one: `latestPatch`, `latestFeature`, `latestMinor` and `latestMajor` take the **highest** SDK the policy allows, while `feature`, `minor` and `major` roll forward to the **nearest** higher feature band, minor or major and then take its latest patch. `patch` — the default when `rollForward` is omitted — prefers the declared version, otherwise the latest patch in its band. `disable` and a prerelease `sdk.version` require an exact match, and `allowPrerelease` is not used: `dotnet-quality` is the only prerelease control.
`check-latest: false` also reuses matching runtime pairs, including those installed by an SDK. Reuse requires each framework's `.deps.json` and a runnable `dotnet` executable; a preview ASP.NET Core runtime pairs with the .NET runtime named in its `runtimeconfig.json`, and before .NET Core 2.1, only the base framework is required. Incomplete pairs, cross-architecture requests, LTS/STS channels and bare wildcards use the online path, so this is not a guarantee of offline operation. The online installer skips versions that are already present, so falling back does not repair a damaged installation.
### Setting `check-latest` from the environment ### Setting `check-latest` from the environment
When the input is not set, the action reads the `DOTNET_CHECK_LATEST` environment variable (`true` or `false`, case-insensitive; an unsupported value warns and is ignored), which covers workflows you cannot edit. Setting it on a self-hosted runner alongside SDKs preinstalled under [`DOTNET_INSTALL_DIR`](#environment-variables) lets those workflows run without reaching `aka.ms`, `builds.dotnet.microsoft.com` or `ci.dot.net`. It applies to every job on that runner, so a dedicated runner is recommended; any workflow can still override it with an explicit `check-latest` input. When the input is not set, the action reads the `DOTNET_CHECK_LATEST` environment variable (`true` or `false`, case-insensitive; an unsupported value warns and is ignored), which covers workflows you cannot edit. Setting it on a self-hosted runner alongside SDKs preinstalled under [`DOTNET_INSTALL_DIR`](#environment-variables) lets those workflows run without reaching `aka.ms`, `builds.dotnet.microsoft.com` or `ci.dot.net`. It applies to every job on that runner, so a dedicated runner is recommended; any workflow can still override it with an explicit `check-latest` input.
@@ -452,7 +480,13 @@ You can also set `DOTNET_INSTALL_DIR` to a value based on runtime variables, suc
- name: Set DOTNET_INSTALL_DIR - name: Set DOTNET_INSTALL_DIR
run: echo "DOTNET_INSTALL_DIR=$HOME/.dotnet" >> $GITHUB_ENV run: echo "DOTNET_INSTALL_DIR=$HOME/.dotnet" >> $GITHUB_ENV
``` ```
> **Note**: On some self-hosted or large Linux runners, installing .NET under the default `/usr/share/dotnet` location may fail due to insufficient permissions. To ensure successful installation, set `DOTNET_INSTALL_DIR` to a user-writable path. > **Note**: On some self-hosted, larger or containerized runners the default location is not writable by the current user, and the installation fails with a permission error. The action resolves the install directory in this order:
>
> 1. `DOTNET_INSTALL_DIR`, when set. It is always honored and never probed.
> 2. The default location for the runner OS, when it is writable.
> 3. `.dotnet` in the current user's home directory, for example `/home/runner/.dotnet` or `C:\Users\runneradmin\.dotnet`.
>
> Runners that can write to the default location are unaffected. When the fallback is used, `DOTNET_ROOT` and `PATH` point at the home directory, so .NET preinstalled under the system location is no longer picked up. Set `DOTNET_INSTALL_DIR` explicitly to pin the location. If no writable location is found, the action warns and keeps the default, so the installation is likely to fail.
## Recommended permissions ## Recommended permissions

View File

@@ -11,6 +11,7 @@ import {
import each from 'jest-each'; import each from 'jest-each';
import semver from 'semver'; import semver from 'semver';
import fspromises from 'fs/promises'; import fspromises from 'fs/promises';
import type {Stats} from 'fs';
import os from 'os'; import os from 'os';
import path from 'path'; import path from 'path';
@@ -35,31 +36,55 @@ jest.unstable_mockModule('@actions/io', () => ({
jest.unstable_mockModule('fs', () => { jest.unstable_mockModule('fs', () => {
const actual = jest.requireActual('fs') as typeof import('fs'); const actual = jest.requireActual('fs') as typeof import('fs');
const chmodSync = jest.fn(); const chmodSync = jest.fn();
const lstatSync = jest.fn(actual.lstatSync);
const mkdtempSync = jest.fn(actual.mkdtempSync);
const rmSync = jest.fn(actual.rmSync);
const readdirSync = jest.fn(); const readdirSync = jest.fn();
const readFileSync = jest.fn(actual.readFileSync);
const existsSync = jest.fn(() => true); const existsSync = jest.fn(() => true);
const statSync = jest.fn(() => ({isFile: () => true})); const statSync = jest.fn(() => ({isFile: () => true}));
const accessSync = jest.fn(); const accessSync = jest.fn();
return { const mocked = {
...actual, ...actual,
chmodSync, chmodSync,
lstatSync,
mkdtempSync,
rmSync,
readdirSync, readdirSync,
readFileSync,
existsSync, existsSync,
statSync, statSync,
accessSync, accessSync
default: {
...actual,
chmodSync,
readdirSync,
existsSync,
statSync,
accessSync
}
}; };
return {
...mocked,
default: mocked
};
});
jest.unstable_mockModule('os', () => {
const actual = jest.requireActual('os') as typeof import('os');
// os.homedir() reads the real environment, not jest's process.env.
const homedir = jest.fn(actual.homedir);
// Resolved per call, so spies placed on the real module still take effect.
const arch = () => actual.arch();
return {...actual, homedir, arch, default: {...actual, homedir, arch}};
});
// Allows tests to re-import the installer as if running on another OS.
let platformOverride: 'windows' | 'linux' | 'mac' | undefined;
jest.unstable_mockModule('../src/utils.js', () => {
const actual = jest.requireActual(
'../src/utils.js'
) as typeof import('../src/utils.js');
const platform = platformOverride ?? actual.PLATFORM;
return {...actual, PLATFORM: platform, IS_WINDOWS: platform === 'windows'};
}); });
const exec = await import('@actions/exec'); const exec = await import('@actions/exec');
const core = await import('@actions/core'); const core = await import('@actions/core');
const io = await import('@actions/io'); const io = await import('@actions/io');
const hc = await import('@actions/http-client');
const fs = await import('fs'); const fs = await import('fs');
const installer = await import('../src/installer.js'); const installer = await import('../src/installer.js');
const {IS_WINDOWS} = await import('../src/utils.js'); const {IS_WINDOWS} = await import('../src/utils.js');
@@ -1349,6 +1374,182 @@ describe('installer tests', () => {
}); });
}); });
describe('installRuntime() tests', () => {
const readdirSyncSpy = fs.readdirSync as unknown as jest.Mock;
const statSyncSpy = fs.statSync as unknown as jest.Mock;
const accessSyncSpy = fs.accessSync as unknown as jest.Mock;
const scriptArgs = () =>
getExecOutputSpy.mock.calls.map(call =>
(call[1] as string[]).join(' ')
);
const arg = (name: string, value: string) =>
IS_WINDOWS ? `-${name} ${value}` : `--${name.toLowerCase()} ${value}`;
beforeEach(() => {
jest.clearAllMocks();
delete process.env['DOTNET_INSTALL_DIR'];
whichSpy.mockImplementation(() => Promise.resolve('PathToShell'));
chmodSyncSpy.mockImplementation(() => {});
readdirSyncSpy.mockReturnValue([]);
statSyncSpy.mockReturnValue({isFile: () => true});
accessSyncSpy.mockImplementation(() => undefined);
getExecOutputSpy.mockImplementation(() =>
Promise.resolve({
exitCode: 0,
stdout: 'Installed version is 8.0.11',
stderr: ''
})
);
});
afterAll(() => {
jest.resetAllMocks();
});
it('should install the .NET and ASP.NET Core runtimes and set DOTNET_INSTALL_DIR', async () => {
const installedVersion = await new installer.DotnetCoreInstaller(
'8.0.11',
''
).installRuntime();
expect(installedVersion).toBe('8.0.11');
expect(process.env['DOTNET_INSTALL_DIR']).toBe(
installer.DotnetInstallDir.dirPath
);
expect(scriptArgs()).toHaveLength(2);
expect(scriptArgs()[0]).toContain(arg('Runtime', 'dotnet'));
expect(scriptArgs()[1]).toContain(arg('Runtime', 'aspnetcore'));
for (const args of scriptArgs()) {
expect(args).toContain(arg('Version', '8.0.11'));
}
});
it('should install the ASP.NET Core build paired with a prerelease runtime', async () => {
const getJsonSpy = jest
.spyOn(hc.HttpClient.prototype, 'getJson')
.mockResolvedValue({
statusCode: 200,
headers: {},
result: {
releases: [
{
runtime: {version: '8.0.0-rc.2.23479.6'},
'aspnetcore-runtime': {version: '8.0.0-rc.2.23480.2'}
}
]
}
});
try {
await new installer.DotnetCoreInstaller(
'8.0.0-rc.2.23479.6',
''
).installRuntime();
} finally {
getJsonSpy.mockRestore();
}
expect(scriptArgs()[0]).toContain(arg('Version', '8.0.0-rc.2.23479.6'));
expect(scriptArgs()[1]).toContain(arg('Version', '8.0.0-rc.2.23480.2'));
});
it('should reuse a complete local runtime pair when check-latest is false', async () => {
readdirSyncSpy.mockReturnValue([
{name: '8.0.11', isDirectory: () => true, isSymbolicLink: () => false}
]);
const installedVersion = await new installer.DotnetCoreInstaller(
'8.0.x',
'',
undefined,
undefined,
false
).installRuntime();
expect(installedVersion).toBe('8.0.11');
expect(getExecOutputSpy).not.toHaveBeenCalled();
});
describe('check-latest: false preview runtime pairing', () => {
const readFileSyncSpy = fs.readFileSync as unknown as jest.Mock;
const runtimeVersion = '8.0.0-rc.2.23479.6';
const config = (version: string) => () =>
JSON.stringify({
runtimeOptions: {
framework: {name: 'Microsoft.NETCore.App', version}
}
});
afterEach(() => readFileSyncSpy.mockReset());
it.each([
['skip installation for a valid mapping', config(runtimeVersion), 0],
[
'fall back online for a missing config',
() => {
throw new Error('ENOENT');
},
2
],
['fall back online for a malformed config', () => '{', 2],
[
'fall back online for an absent declared runtime',
config('8.0.0-rc.2.23475.1'),
2
]
])('should %s', async (_, readConfig, installCalls) => {
// The ASP.NET Core preview build differs from the .NET runtime build.
readdirSyncSpy.mockImplementation((...args: unknown[]) =>
[
path.basename(args[0] as string) === 'Microsoft.NETCore.App'
? runtimeVersion
: '8.0.0-rc.2.23480.2'
].map(name => ({
name,
isDirectory: () => true,
isSymbolicLink: () => false
}))
);
readFileSyncSpy.mockImplementation(readConfig);
const getJsonSpy = jest
.spyOn(hc.HttpClient.prototype, 'getJson')
.mockRejectedValue(new Error('offline'));
try {
await new installer.DotnetCoreInstaller(
runtimeVersion,
'',
undefined,
undefined,
false
).installRuntime();
} finally {
getJsonSpy.mockRestore();
}
expect(getExecOutputSpy).toHaveBeenCalledTimes(installCalls);
});
});
it.each([
[
'8.0.1xx',
` The A.B.Cxx feature band syntax applies only to .NET SDKs and is supported only by 'dotnet-version'.`
],
['abc', '']
])(
"should reject '%s' with an error naming 'dotnet-runtime' before installing",
async (version, reason) => {
await expect(
new installer.DotnetCoreInstaller(version, '').installRuntime()
).rejects.toThrow(
`The 'dotnet-runtime' was supplied in invalid format: ${version}!${reason} Supported syntax: A.B.C, A.B, A.B.x, A, A.x, latest`
);
expect(getExecOutputSpy).not.toHaveBeenCalled();
}
);
});
describe('addToPath() tests', () => { describe('addToPath() tests', () => {
it(`should export DOTNET_ROOT env.var with value from DOTNET_INSTALL_DIR env.var`, async () => { it(`should export DOTNET_ROOT env.var with value from DOTNET_INSTALL_DIR env.var`, async () => {
process.env['DOTNET_INSTALL_DIR'] = 'fictitious/dotnet/install/dir'; process.env['DOTNET_INSTALL_DIR'] = 'fictitious/dotnet/install/dir';
@@ -1364,6 +1565,240 @@ describe('installer tests', () => {
expect(path).toContain(process.env['DOTNET_INSTALL_DIR']); expect(path).toContain(process.env['DOTNET_INSTALL_DIR']);
}); });
}); });
describe('install directory fallback tests', () => {
// Mock factories re-run on resetModules, so the installer sees new
// instances; configure those, not the ones captured at file load.
const importInstallerFor = async (
platform: 'windows' | 'linux' | 'mac',
isWritable: (dir: string) => boolean
) => {
platformOverride = platform;
jest.resetModules();
const freshFs = await import('fs');
(freshFs.lstatSync as jest.Mock).mockReturnValue({} as Stats);
(freshFs.mkdtempSync as jest.Mock).mockImplementation(
(...args: unknown[]) => {
const prefix = String(args[0]);
if (!isWritable(path.dirname(prefix))) {
throw Object.assign(new Error('permission denied'), {
code: 'EACCES'
});
}
return `${prefix}abc123`;
}
);
(freshFs.rmSync as jest.Mock).mockImplementation(() => {});
const freshCore = await import('@actions/core');
const freshOs = await import('os');
const {DotnetInstallDir} = await import('../src/installer.js');
return {DotnetInstallDir, core: freshCore, fs: freshFs, os: freshOs};
};
const probedDirs = (freshFs: typeof import('fs')) =>
(freshFs.mkdtempSync as jest.Mock).mock.calls.map(call =>
path.dirname(String(call[0]))
);
beforeEach(() => {
delete process.env['DOTNET_INSTALL_DIR'];
});
afterEach(() => {
platformOverride = undefined;
});
it(`should use the default location when it is writable`, async () => {
const {DotnetInstallDir} = await importInstallerFor(
'linux',
() => true
);
expect(DotnetInstallDir.dirPath).toBe('/usr/share/dotnet');
});
it(`should fall back to the home directory when the default location is not writable`, async () => {
const fallbackPath = path.join(os.homedir(), '.dotnet');
const {DotnetInstallDir, core: freshCore} = await importInstallerFor(
'linux',
dir => dir === fallbackPath
);
expect(DotnetInstallDir.dirPath).toBe(fallbackPath);
expect(freshCore.warning).toHaveBeenCalled();
});
it(`should reject a dangling symlink instead of probing its writable parent`, async () => {
// Resolved, because that is the form the probe receives on every platform.
const linkPath = path.resolve('/usr/share/dotnet');
const {DotnetInstallDir, fs: freshFs} = await importInstallerFor(
'linux',
() => true
);
// A dangling link exists for lstat, but nothing can be created under it.
(freshFs.mkdtempSync as jest.Mock).mockImplementation(
(...args: unknown[]) => {
if (path.dirname(String(args[0])) === linkPath) {
throw Object.assign(new Error('no such file or directory'), {
code: 'ENOENT'
});
}
return `${args[0]}abc123`;
}
);
expect(DotnetInstallDir.dirPath).toBe(
path.join(os.homedir(), '.dotnet')
);
const probed = probedDirs(freshFs);
expect(probed).toContain(linkPath);
expect(probed).not.toContain(path.dirname(linkPath));
});
it(`should probe the nearest existing parent when the directory is missing`, async () => {
const systemPath = path.resolve('/usr/share/dotnet');
const parentPath = path.dirname(systemPath);
const {DotnetInstallDir, fs: freshFs} = await importInstallerFor(
'linux',
() => true
);
// Only the parent exists, so the walk has to climb before probing.
(freshFs.lstatSync as jest.Mock).mockImplementation(
(...args: unknown[]) =>
path.resolve(String(args[0])) === parentPath
? ({} as Stats)
: undefined
);
expect(DotnetInstallDir.dirPath).toBe('/usr/share/dotnet');
const probed = probedDirs(freshFs);
expect(probed).toContain(parentPath);
expect(probed).not.toContain(systemPath);
});
it(`should give up at the filesystem root when no ancestor exists`, async () => {
const systemPath = path.resolve('/usr/share/dotnet');
const homePath = path.join(os.homedir(), '.dotnet');
const {DotnetInstallDir, fs: freshFs} = await importInstallerFor(
'linux',
() => true
);
// Nothing on the system path exists, all the way up to the root.
(freshFs.lstatSync as jest.Mock).mockImplementation(
(...args: unknown[]) =>
systemPath.startsWith(path.resolve(String(args[0])))
? undefined
: ({} as Stats)
);
expect(DotnetInstallDir.dirPath).toBe(homePath);
// The walk hit the root and returned without ever probing.
expect(probedDirs(freshFs)).toEqual([homePath]);
});
it(`should not probe a relative default location`, async () => {
// An unset HOME makes the macOS default relative, e.g. 'undefined/.dotnet'.
delete process.env['HOME'];
const homePath = path.join(os.homedir(), '.dotnet');
const {DotnetInstallDir, fs: freshFs} = await importInstallerFor(
'mac',
() => true
);
expect(DotnetInstallDir.dirPath).toBe(homePath);
expect(probedDirs(freshFs)).not.toContain(process.cwd());
});
it(`should not probe a relative default location on Windows`, async () => {
// An unset PROGRAMFILES makes the Windows default relative.
delete process.env['PROGRAMFILES'];
const homePath = path.join(os.homedir(), '.dotnet');
const {DotnetInstallDir, fs: freshFs} = await importInstallerFor(
'windows',
() => true
);
expect(DotnetInstallDir.dirPath).toBe(homePath);
expect(probedDirs(freshFs)).not.toContain(process.cwd());
});
it(`should not treat the filesystem root as a home directory`, async () => {
const root = path.parse(process.cwd()).root;
const rootDotnet = path.join(root, '.dotnet');
// Only the root candidate is writable, so an unguarded run would pick it.
const {
DotnetInstallDir,
os: freshOs,
core: freshCore
} = await importInstallerFor('linux', dir => dir === rootDotnet);
(freshOs.homedir as jest.Mock).mockReturnValue(root);
expect(DotnetInstallDir.dirPath).toBe('/usr/share/dotnet');
expect(freshCore.warning).toHaveBeenCalled();
});
it(`should still report writable when the probe cannot be removed`, async () => {
const {DotnetInstallDir, fs: freshFs} = await importInstallerFor(
'linux',
() => true
);
(freshFs.rmSync as jest.Mock).mockImplementation(() => {
throw Object.assign(new Error('device or resource busy'), {
code: 'EBUSY'
});
});
expect(DotnetInstallDir.dirPath).toBe('/usr/share/dotnet');
});
it(`should keep the shared macOS location and warn when it is not writable`, async () => {
// The mac default derives from HOME, homeInstallPath() from os.homedir();
// aligning them is what makes both candidates the same path.
process.env['HOME'] = os.homedir();
const homePath = path.join(os.homedir(), '.dotnet');
const {
DotnetInstallDir,
fs: freshFs,
core: freshCore
} = await importInstallerFor('mac', () => false);
expect(DotnetInstallDir.dirPath).toBe(homePath);
// One candidate, so it is probed once rather than twice.
expect(probedDirs(freshFs)).toEqual([homePath]);
expect(freshCore.warning).toHaveBeenCalled();
});
it(`should prefer DOTNET_INSTALL_DIR env.var without probing`, async () => {
process.env['DOTNET_INSTALL_DIR'] = path.join(path.sep, 'custom');
const {DotnetInstallDir, fs: freshFs} = await importInstallerFor(
'linux',
() => false
);
expect(DotnetInstallDir.dirPath).toBe(path.join(path.sep, 'custom'));
expect(freshFs.mkdtempSync as jest.Mock).not.toHaveBeenCalled();
});
it(`should resolve once, and not before the directory is needed`, async () => {
const {DotnetInstallDir, fs: freshFs} = await importInstallerFor(
'linux',
() => true
);
const probe = freshFs.mkdtempSync as jest.Mock;
expect(probe).not.toHaveBeenCalled();
void DotnetInstallDir.dirPath;
const afterFirstRead = probe.mock.calls.length;
void DotnetInstallDir.dirPath;
expect(afterFirstRead).toBeGreaterThan(0);
expect(probe.mock.calls.length).toBe(afterFirstRead);
});
});
}); });
describe('normalizeArch() tests', () => { describe('normalizeArch() tests', () => {

View File

@@ -9,6 +9,7 @@ import {
} from '@jest/globals'; } from '@jest/globals';
import semver from 'semver'; import semver from 'semver';
import os from 'os'; import os from 'os';
import path from 'path';
jest.unstable_mockModule('@actions/core', () => ({ jest.unstable_mockModule('@actions/core', () => ({
getInput: jest.fn(), getInput: jest.fn(),
@@ -75,6 +76,11 @@ describe('setup-dotnet tests', () => {
'installDotnet' 'installDotnet'
); );
const installRuntimeSpy = jest.spyOn(
DotnetCoreInstaller.prototype,
'installRuntime'
);
const isCacheFeatureAvailableSpy = const isCacheFeatureAvailableSpy =
cacheUtils.isCacheFeatureAvailable as jest.Mock; cacheUtils.isCacheFeatureAvailable as jest.Mock;
const restoreCacheSpy = cacheRestore.restoreCache as jest.Mock; const restoreCacheSpy = cacheRestore.restoreCache as jest.Mock;
@@ -84,6 +90,7 @@ describe('setup-dotnet tests', () => {
describe('run() tests', () => { describe('run() tests', () => {
beforeEach(() => { beforeEach(() => {
DotnetInstallDir.addToPath = jest.fn(); DotnetInstallDir.addToPath = jest.fn();
inputs['dotnet-runtime'] = [];
getMultilineInputSpy.mockImplementation(input => inputs[input as string]); getMultilineInputSpy.mockImplementation(input => inputs[input as string]);
getInputSpy.mockImplementation(input => inputs[input as string]); getInputSpy.mockImplementation(input => inputs[input as string]);
getBooleanInputSpy.mockImplementation(input => { getBooleanInputSpy.mockImplementation(input => {
@@ -205,6 +212,97 @@ describe('setup-dotnet tests', () => {
expect(DotnetInstallDir.addToPath).toHaveBeenCalledTimes(1); expect(DotnetInstallDir.addToPath).toHaveBeenCalledTimes(1);
}); });
describe('dotnet-runtime input', () => {
beforeEach(() => {
inputs['global-json-file'] = '';
inputs['dotnet-version'] = [];
inputs['dotnet-quality'] = '';
inputs['dotnet-channel'] = '';
inputs['architecture'] = '';
existsSyncSpy.mockReturnValue(false);
});
afterEach(() => {
inputs['dotnet-channel'] = '';
inputs['dotnet-quality'] = '';
inputs['check-latest'] = '';
inputs['architecture'] = '';
delete process.env['DOTNET_INSTALL_DIR'];
});
it('should install unique runtime versions, add PATH and not set the dotnet-version output without an SDK', async () => {
inputs['dotnet-runtime'] = ['8.0.x', '9.0.x', '8.0.x'];
installRuntimeSpy
.mockResolvedValueOnce('8.0.11')
.mockResolvedValueOnce('9.0.1');
await setup.run();
expect(setFailedSpy).not.toHaveBeenCalled();
expect(installDotnetSpy).not.toHaveBeenCalled();
expect(installRuntimeSpy).toHaveBeenCalledTimes(2);
expect(DotnetInstallDir.addToPath).toHaveBeenCalledTimes(1);
expect(setOutputSpy).not.toHaveBeenCalled();
});
it('should forward dotnet-channel (feature band as A.B), dotnet-quality and check-latest to runtime latest', async () => {
inputs['dotnet-runtime'] = ['latest'];
inputs['dotnet-channel'] = '8.0.1xx';
inputs['dotnet-quality'] = 'preview';
inputs['check-latest'] = 'false';
let capturedOptions: object | undefined;
installRuntimeSpy.mockImplementation(function (this: {
dotnetChannel?: string;
quality: string;
checkLatest: boolean;
}) {
capturedOptions = {
dotnetChannel: this.dotnetChannel,
quality: this.quality,
checkLatest: this.checkLatest
};
return Promise.resolve('8.0.0-preview.1');
});
await setup.run();
expect(setFailedSpy).not.toHaveBeenCalled();
expect(capturedOptions).toEqual({
dotnetChannel: '8.0',
quality: 'preview',
checkLatest: false
});
});
it('should fail the action if unsupported dotnet-channel value is provided with runtime latest', async () => {
inputs['dotnet-runtime'] = ['latest'];
inputs['dotnet-channel'] = 'invalid';
await setup.run();
expect(setFailedSpy).toHaveBeenCalledWith(
`Value 'invalid' is not supported for the 'dotnet-channel' option. Supported values are: LTS, STS, A.B (e.g. 8.0), A.B.Cxx (e.g. 8.0.1xx).`
);
expect(installRuntimeSpy).not.toHaveBeenCalled();
});
it('should keep the cross-architecture DOTNET_INSTALL_DIR after installing an SDK and a runtime', async () => {
const architecture = os.arch() === 'arm64' ? 'x64' : 'arm64';
inputs['dotnet-version'] = ['8.0.x'];
inputs['dotnet-runtime'] = ['9.0.x'];
inputs['architecture'] = architecture;
installDotnetSpy.mockResolvedValue('8.0.404');
installRuntimeSpy.mockImplementation(() => {
DotnetInstallDir.setEnvironmentVariable();
return Promise.resolve('9.0.1');
});
await setup.run();
expect(setFailedSpy).not.toHaveBeenCalled();
expect(process.env['DOTNET_INSTALL_DIR']).toBe(
path.join(DotnetInstallDir.dirPath, architecture)
);
expect(DotnetInstallDir.addToPath).toHaveBeenCalledTimes(1);
});
});
it(`shouldn't call setOutput() if parsing dotnet-installer logs failed`, async () => { it(`shouldn't call setOutput() if parsing dotnet-installer logs failed`, async () => {
inputs['dotnet-version'] = ['10.0.101']; inputs['dotnet-version'] = ['10.0.101'];
const warningMessage = `Failed to output the installed version of .NET. The 'dotnet-version' output will not be set.`; const warningMessage = `Failed to output the installed version of .NET. The 'dotnet-version' output will not be set.`;
@@ -502,7 +600,7 @@ describe('setup-dotnet tests', () => {
await setup.run(); await setup.run();
expect(setFailedSpy).not.toHaveBeenCalled(); expect(setFailedSpy).not.toHaveBeenCalled();
expect(warningSpy).toHaveBeenCalledWith( expect(warningSpy).toHaveBeenCalledWith(
`The 'dotnet-channel' input is only supported when 'dotnet-version' is set to 'latest'.` `The 'dotnet-channel' input is only supported when 'dotnet-version' or 'dotnet-runtime' is set to 'latest'.`
); );
}); });

View File

@@ -8,11 +8,14 @@ inputs:
dotnet-version: dotnet-version:
description: 'Optional SDK version(s) to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x, 3.x, 6.0.2xx, latest' description: 'Optional SDK version(s) to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x, 3.x, 6.0.2xx, latest'
required: false required: false
dotnet-runtime:
description: 'Optional runtime version(s) to install, including the paired ASP.NET Core runtime for .NET Core 2.1 and later. Supports the same version syntax as dotnet-version, except the SDK-only A.B.Cxx feature band syntax. Examples: 8.0.x, 9.0.x, 8.0.0'
required: false
dotnet-quality: dotnet-quality:
description: 'Optional quality of the build. The possible values are: daily, preview, ga.' description: 'Optional quality of the build. The possible values are: daily, preview, ga.'
required: false required: false
dotnet-channel: dotnet-channel:
description: 'Optional channel for the installation. The possible values are: STS, LTS, A.B (e.g. 8.0), A.B.Cxx (e.g. 8.0.1xx, available since 5.0). To be used with "dotnet-version: latest".' description: 'Optional channel for the installation. The possible values are: STS, LTS, A.B (e.g. 8.0), A.B.Cxx (e.g. 8.0.1xx, available since 5.0; dotnet-runtime uses its A.B channel). To be used with "dotnet-version: latest" or "dotnet-runtime: latest".'
required: false required: false
skip-lts-prepass: skip-lts-prepass:
description: 'Optional. When true, skips the LTS runtime pre-pass and installs only the requested dotnet-version. Default: false.' description: 'Optional. When true, skips the LTS runtime pre-pass and installs only the requested dotnet-version. Default: false.'
@@ -44,7 +47,7 @@ inputs:
description: 'Optional architecture for the .NET install. Supported values: x64, x86, arm64, amd64, arm, s390x, ppc64le, riscv64. If not set, the installer auto-detects the current system architecture.' description: 'Optional architecture for the .NET install. Supported values: x64, x86, arm64, amd64, arm, s390x, ppc64le, riscv64. If not set, the installer auto-detects the current system architecture.'
required: false required: false
check-latest: check-latest:
description: 'Optional, defaults to true. When false, a locally installed SDK that satisfies the requested version is reused without any network calls, otherwise the latest matching version is installed online. Cross-architecture requests always install online. Falls back to the DOTNET_CHECK_LATEST environment variable when this input is not set.' description: 'Optional, defaults to true. When false, a locally installed SDK or complete runtime pair that satisfies the request is reused without resolution or download; otherwise installation proceeds online. Cross-architecture requests and LTS/STS channel resolution use the online path. Falls back to DOTNET_CHECK_LATEST when this input is not set.'
required: false required: false
outputs: outputs:
cache-hit: cache-hit:

7853
dist/cache-save/index.js vendored

File diff suppressed because it is too large Load Diff

11768
dist/setup/index.js vendored

File diff suppressed because it is too large Load Diff

198
package-lock.json generated
View File

@@ -1,15 +1,15 @@
{ {
"name": "setup-dotnet", "name": "setup-dotnet",
"version": "6.0.0", "version": "6.1.0",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "setup-dotnet", "name": "setup-dotnet",
"version": "6.0.0", "version": "6.1.0",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^6.2.0", "@actions/cache": "^6.3.0",
"@actions/core": "^3.0.1", "@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
"@actions/github": "^9.1.1", "@actions/github": "^9.1.1",
@@ -56,30 +56,20 @@
} }
}, },
"node_modules/@actions/cache": { "node_modules/@actions/cache": {
"version": "6.2.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/@actions/cache/-/cache-6.2.0.tgz", "resolved": "https://registry.npmjs.org/@actions/cache/-/cache-6.3.0.tgz",
"integrity": "sha512-Nv0xWRmbxfDbAn/70flO/F6tj2Nv4XTYMAsQHiDFSojCDfso/Zni+fRKa14ToI9hnmOW/rQcY1WYb6wsM7Pgwg==", "integrity": "sha512-SJKaVMqTgetQgJF0wifi5N2+2mffCLy/D4w/3sJtRanBBGECdi1/OD0wswyLVmqEmPbYB/rVJk41Qn/xEbFjAw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/core": "^3.0.1", "@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
"@actions/glob": "^0.6.1", "@actions/glob": "^0.7.0",
"@actions/http-client": "^4.0.1", "@actions/http-client": "^4.0.1",
"@actions/io": "^3.0.2", "@actions/io": "^3.0.2",
"@azure/core-rest-pipeline": "^1.23.0", "@azure/core-rest-pipeline": "~1.23.0",
"@azure/storage-blob": "^12.31.0", "@azure/storage-blob": "~12.31.0",
"@protobuf-ts/runtime-rpc": "^2.11.1", "@protobuf-ts/runtime-rpc": "^2.11.1",
"semver": "^7.7.4" "semver": "^7.8.5"
}
},
"node_modules/@actions/cache/node_modules/@actions/glob": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.6.1.tgz",
"integrity": "sha512-K4+2Ac5ILcf2ySdJCha+Pop9NcKjxqCL4xL4zI50dgB2PbXgC0+AcP011xfH4Of6b4QEJJg8dyZYv7zl4byTsw==",
"license": "MIT",
"dependencies": {
"@actions/core": "^3.0.0",
"minimatch": "^3.0.4"
} }
}, },
"node_modules/@actions/core": { "node_modules/@actions/core": {
@@ -168,21 +158,21 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@azure/abort-controller": { "node_modules/@azure/abort-controller": {
"version": "2.1.2", "version": "2.2.0",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.1.2.tgz", "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.2.0.tgz",
"integrity": "sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA==", "integrity": "sha512-fNAjWnA/nZ2jz31kxR/AqRaUT8ewHBw/WuBIosK0moMy1C9e5ValbDfFdIxJzVOOYaYkV/b2F1S4H/aHiqfVQg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=22.0.0"
} }
}, },
"node_modules/@azure/core-auth": { "node_modules/@azure/core-auth": {
"version": "1.10.1", "version": "1.11.0",
"resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.10.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.11.0.tgz",
"integrity": "sha512-ykRMW8PjVAn+RS6ww5cmK9U2CyH9p4Q88YJwvUslfuMmN98w/2rdGRLPqJYObapBCdzBVeDgYWdJnFPFb7qzpg==", "integrity": "sha512-IUZydyTUkDnYdstOW9pFOOUQlBjAepK5teihDE3x6yxsPJs/hsAaaYpeGxdxrgtOiJbBKSjKW7MDk7AEhb4LRg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
@@ -190,13 +180,13 @@
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=22.0.0"
} }
}, },
"node_modules/@azure/core-client": { "node_modules/@azure/core-client": {
"version": "1.10.2", "version": "1.11.1",
"resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.10.2.tgz", "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.11.1.tgz",
"integrity": "sha512-1D2LpsU7y9xrqKjdIbsB7PlrRePw0xsVV8p+AKTlzITrWmscajryfJCdDJB/oGwvDI5HmRo04eMMADB67uwAwQ==", "integrity": "sha512-2QygG2F76ZpMP2eMztiJvAiFMu71M9rDeU7vO/QKg5Css7MgM4frUOslFjhVjRhbGaCNPtz/S8M6y46/fFKVuQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
@@ -208,19 +198,19 @@
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=22.0.0"
} }
}, },
"node_modules/@azure/core-http-compat": { "node_modules/@azure/core-http-compat": {
"version": "2.4.0", "version": "2.5.0",
"resolved": "https://registry.npmjs.org/@azure/core-http-compat/-/core-http-compat-2.4.0.tgz", "resolved": "https://registry.npmjs.org/@azure/core-http-compat/-/core-http-compat-2.5.0.tgz",
"integrity": "sha512-f1P96IB399YiN2ARYHP7EpZi3Bf3wH4SN2lGzrw7JVwm7bbsVYtf2iKSBwTywD2P62NOPZGHFSZi+6jjb75JuA==", "integrity": "sha512-BoSmXPx2er1Ai+wKlDvj29jIQespCNBwEmKyZVHO2kEFsWbGjAjwMCGzug3DJM5/QYIV3vej0S1zcU5bq9fa8w==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2" "@azure/abort-controller": "^2.1.2"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=22.0.0"
}, },
"peerDependencies": { "peerDependencies": {
"@azure/core-client": "^1.10.0", "@azure/core-client": "^1.10.0",
@@ -243,21 +233,21 @@
} }
}, },
"node_modules/@azure/core-paging": { "node_modules/@azure/core-paging": {
"version": "1.6.2", "version": "1.7.0",
"resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.6.2.tgz", "resolved": "https://registry.npmjs.org/@azure/core-paging/-/core-paging-1.7.0.tgz",
"integrity": "sha512-YKWi9YuCU04B55h25cnOYZHxXYtEvQEbKST5vqRga7hWY9ydd3FZHdeQF8pyh+acWZvppw13M/LMGx0LABUVMA==", "integrity": "sha512-7GEAoIsaoBr6KELNRb8nypowCqvk8dnCHFCYg4XD4lOQGY2GqjQg5IhkRjyBFRO18CGSMq05PaNqSOE9GQro3g==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=18.0.0" "node": ">=22.0.0"
} }
}, },
"node_modules/@azure/core-rest-pipeline": { "node_modules/@azure/core-rest-pipeline": {
"version": "1.24.0", "version": "1.23.0",
"resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.24.0.tgz", "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.23.0.tgz",
"integrity": "sha512-PpLsoDQ3AMmKZ0VU+0GrmqMxgp/sExjlVm4R+nLWngeoEGAzOIPVifaxKGU5gMv+nWELUoHfvrolWD+ZS/nFJg==", "integrity": "sha512-Evs1INHo+jUjwHi1T6SG6Ua/LHOQBCLuKEEE6efIpt4ZOoNonaT1kP32GoOcdNDbfqsD2445CPri3MubBy5DEQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
@@ -273,21 +263,21 @@
} }
}, },
"node_modules/@azure/core-tracing": { "node_modules/@azure/core-tracing": {
"version": "1.3.1", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.3.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.4.0.tgz",
"integrity": "sha512-9MWKevR7Hz8kNzzPLfX4EAtGM2b8mr50HPDBvio96bURP/9C+HjdH3sBlLSNNrvRAr5/k/svoH457gB5IKpmwQ==", "integrity": "sha512-eGwxD0AtncrxeBM4tG8R55Pc3rdX1hNW2WibJAgYpCVA6E93mvvVH+LcssoVjOBrSKWS55yEIHsk0X8ctHmfOQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=22.0.0"
} }
}, },
"node_modules/@azure/core-util": { "node_modules/@azure/core-util": {
"version": "1.13.1", "version": "1.14.0",
"resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.13.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.14.0.tgz",
"integrity": "sha512-XPArKLzsvl0Hf0CaGyKHUyVgF7oDnhKoP85Xv6M4StF/1AhfORhZudHtOyf2s+FcbuQ9dPRAjB8J2KvRRMUK2A==", "integrity": "sha512-9n2pWK61veAuN0V20t9lOuoV4CFMdyAZ1ygZzvBGk/pBBJRib/PjL9PLXa/aI2CcPpyHfqVsxxqLCYl6uZlfDw==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
@@ -295,39 +285,39 @@
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=22.0.0"
} }
}, },
"node_modules/@azure/core-xml": { "node_modules/@azure/core-xml": {
"version": "1.5.1", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/@azure/core-xml/-/core-xml-1.5.1.tgz", "resolved": "https://registry.npmjs.org/@azure/core-xml/-/core-xml-1.6.0.tgz",
"integrity": "sha512-xcNRHqCoSp4AunOALEae6A8f3qATb83gSrm31Iqb01OzblvC3/W/bfXozcq78EzIdzZzuH1bZ2NvRR0TdX709w==", "integrity": "sha512-e7lX/dk//F6Qf7BB6PTY4+p2yuOQtyOeHGyapYHNwqSp2OnYpwQt49A/Nin2XmKBQ69pwagR4k/lQBq8lbHQkA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fast-xml-parser": "^5.5.9", "fast-xml-parser": "^5.5.9",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=22.0.0"
} }
}, },
"node_modules/@azure/logger": { "node_modules/@azure/logger": {
"version": "1.3.0", "version": "1.4.0",
"resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.3.0.tgz", "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.4.0.tgz",
"integrity": "sha512-fCqPIfOcLE+CGqGPd66c8bZpwAji98tZ4JI9i/mlTNTlsIWslCfpg48s/ypyLxZTump5sypjrKn2/kY7q8oAbA==", "integrity": "sha512-rbAE25KUfjU/s3XHUdJgceoCP5dEOpMx85J04kF+QMdta73XkuG9JGHHinch+XIoKpBdqljin+KqURpJriSzLA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@typespec/ts-http-runtime": "^0.3.0", "@typespec/ts-http-runtime": "^0.3.0",
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=22.0.0"
} }
}, },
"node_modules/@azure/storage-blob": { "node_modules/@azure/storage-blob": {
"version": "12.32.0", "version": "12.31.0",
"resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.32.0.tgz", "resolved": "https://registry.npmjs.org/@azure/storage-blob/-/storage-blob-12.31.0.tgz",
"integrity": "sha512-80LzSNnFQye2LCCBFghAJS6jJQJ7N4bfgZ6qDMgVGRtugZ7TLDKQZ2hczMigmZH3jAcMRdma/IygsC5+0gT7Tw==", "integrity": "sha512-DBgNv10aCSxopt92DkTDD0o9xScXeBqPKGmR50FPZQaEcH4JLQ+GEOGEDv19V5BMkB7kxr+m4h6il/cCDPvmHg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
@@ -341,7 +331,7 @@
"@azure/core-util": "^1.11.0", "@azure/core-util": "^1.11.0",
"@azure/core-xml": "^1.4.5", "@azure/core-xml": "^1.4.5",
"@azure/logger": "^1.1.4", "@azure/logger": "^1.1.4",
"@azure/storage-common": "^12.4.0", "@azure/storage-common": "^12.3.0",
"events": "^3.0.0", "events": "^3.0.0",
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
@@ -350,14 +340,14 @@
} }
}, },
"node_modules/@azure/storage-common": { "node_modules/@azure/storage-common": {
"version": "12.4.1", "version": "12.5.0",
"resolved": "https://registry.npmjs.org/@azure/storage-common/-/storage-common-12.4.1.tgz", "resolved": "https://registry.npmjs.org/@azure/storage-common/-/storage-common-12.5.0.tgz",
"integrity": "sha512-t14unw/WofGDUi7TKJrsyXyPsN+NLgRm7hMaq0llxNmTIzt7f257+6LE6FKIJPh88zLj6M7LPvzve0fEYg/L3A==", "integrity": "sha512-bttzuhQiCIwrkzjPDA+AtAR7dg19L/CC6ztcqJ5LfvWpXuys9mHp0UQ0udYnoUvv9SCT9KTR5kqFvFr0e6k0lQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@azure/abort-controller": "^2.1.2", "@azure/abort-controller": "^2.1.2",
"@azure/core-auth": "^1.9.0", "@azure/core-auth": "^1.9.0",
"@azure/core-http-compat": "^2.2.0", "@azure/core-http-compat": "^2.4.0",
"@azure/core-rest-pipeline": "^1.24.0", "@azure/core-rest-pipeline": "^1.24.0",
"@azure/core-tracing": "^1.2.0", "@azure/core-tracing": "^1.2.0",
"@azure/core-util": "^1.11.0", "@azure/core-util": "^1.11.0",
@@ -366,7 +356,25 @@
"tslib": "^2.8.1" "tslib": "^2.8.1"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=22.0.0"
}
},
"node_modules/@azure/storage-common/node_modules/@azure/core-rest-pipeline": {
"version": "1.25.0",
"resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.25.0.tgz",
"integrity": "sha512-bMs8ekJLjX8wPV+9IPBges1SLPyuDtE9g5gLDWOpxzKcoOFQnpLGkbcT1tdw3FaAmDS1gnPmMmJ6y/T5B96kIA==",
"license": "MIT",
"dependencies": {
"@azure/abort-controller": "^2.1.2",
"@azure/core-auth": "^1.10.0",
"@azure/core-tracing": "^1.3.0",
"@azure/core-util": "^1.13.0",
"@azure/logger": "^1.3.0",
"@typespec/ts-http-runtime": "^0.3.4",
"tslib": "^2.6.2"
},
"engines": {
"node": ">=22.0.0"
} }
}, },
"node_modules/@babel/code-frame": { "node_modules/@babel/code-frame": {
@@ -2289,9 +2297,9 @@
} }
}, },
"node_modules/@typespec/ts-http-runtime": { "node_modules/@typespec/ts-http-runtime": {
"version": "0.3.6", "version": "0.3.9",
"resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.6.tgz", "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.9.tgz",
"integrity": "sha512-jIXhD0eWQ1JA6ln/5Dltyx22UxWNrw0hZmhy2rlv6m6KgF7kplHx3g0fzi09lNmTJQRR91OlemYp3xFnvDK9og==", "integrity": "sha512-edSdeAqkdxBVzA1yL1LrLCml1YjyCVvPMtMqJpbF+6K609tHe8V6sQUzFQSGcYNhcuhOceZtjvN32+mpIth30A==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"http-proxy-agent": "^7.0.0", "http-proxy-agent": "^7.0.0",
@@ -2299,7 +2307,7 @@
"tslib": "^2.6.2" "tslib": "^2.6.2"
}, },
"engines": { "engines": {
"node": ">=20.0.0" "node": ">=22.0.0"
} }
}, },
"node_modules/@ungap/structured-clone": { "node_modules/@ungap/structured-clone": {
@@ -2888,9 +2896,9 @@
"license": "Apache-2.0" "license": "Apache-2.0"
}, },
"node_modules/brace-expansion": { "node_modules/brace-expansion": {
"version": "5.0.9", "version": "5.0.12",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.9.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz",
"integrity": "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg==", "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^4.0.2" "balanced-match": "^4.0.2"
@@ -3183,6 +3191,7 @@
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/content-type": { "node_modules/content-type": {
@@ -4035,9 +4044,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/glob/node_modules/brace-expansion": { "node_modules/glob/node_modules/brace-expansion": {
"version": "2.1.4", "version": "2.1.7",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.4.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz",
"integrity": "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg==", "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -4087,13 +4096,13 @@
"dev": true "dev": true
}, },
"node_modules/handlebars": { "node_modules/handlebars": {
"version": "4.7.9", "version": "4.7.10",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.9.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.10.tgz",
"integrity": "sha512-4E71E0rpOaQuJR2A3xDZ+GM1HyWYv1clR58tC8emQNeQe3RH7MAzSbat+V0wG78LQBo6m6bzSG/L4pBuCsgnUQ==", "integrity": "sha512-P5VJMVM7qgBn6vjXMw8WG9uVI+ncf2pi72j4de4yz5ZULLj2RGqLYaKOYGsgyrViQ0tePOVlN1tDCCXXtFqXKg==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"minimist": "^1.2.5", "minimist": "^1.2.8",
"neo-async": "^2.6.2", "neo-async": "^2.6.2",
"source-map": "^0.6.1", "source-map": "^0.6.1",
"wordwrap": "^1.0.0" "wordwrap": "^1.0.0"
@@ -4108,6 +4117,16 @@
"uglify-js": "^3.1.4" "uglify-js": "^3.1.4"
} }
}, },
"node_modules/handlebars/node_modules/minimist": {
"version": "1.2.8",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
"dev": true,
"license": "MIT",
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/has-flag": { "node_modules/has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
@@ -5231,6 +5250,7 @@
"version": "3.1.5", "version": "3.1.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
"integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
"dev": true,
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
@@ -5243,12 +5263,14 @@
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/minimatch/node_modules/brace-expansion": { "node_modules/minimatch/node_modules/brace-expansion": {
"version": "1.1.18", "version": "1.1.21",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.18.tgz", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.21.tgz",
"integrity": "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw==", "integrity": "sha512-9zeA+KLZNNzglF2TPKRQEDyx6Yby7daAkuy8MiPzpXPsYDWi/DRM8jmwUDxokQjYqBpv5DgPiwD4h4ZZSy1Ujw==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
@@ -6356,9 +6378,9 @@
} }
}, },
"node_modules/undici": { "node_modules/undici": {
"version": "6.28.0", "version": "6.29.1",
"resolved": "https://registry.npmjs.org/undici/-/undici-6.28.0.tgz", "resolved": "https://registry.npmjs.org/undici/-/undici-6.29.1.tgz",
"integrity": "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA==", "integrity": "sha512-EvRlUt/QqAEvXdQeRMYUfwOQsfzpDztykrG2owGEE/rBOBoYv9uF39ZzsNDh4lTFHhTr2XOZjKkYgueD12ZmGA==",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=18.17" "node": ">=18.17"

View File

@@ -1,6 +1,6 @@
{ {
"name": "setup-dotnet", "name": "setup-dotnet",
"version": "6.0.0", "version": "6.1.0",
"type": "module", "type": "module",
"private": true, "private": true,
"description": "setup dotnet action", "description": "setup dotnet action",
@@ -30,7 +30,7 @@
"author": "GitHub", "author": "GitHub",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@actions/cache": "^6.2.0", "@actions/cache": "^6.3.0",
"@actions/core": "^3.0.1", "@actions/core": "^3.0.1",
"@actions/exec": "^3.0.0", "@actions/exec": "^3.0.0",
"@actions/github": "^9.1.1", "@actions/github": "^9.1.1",

View File

@@ -7,7 +7,11 @@ import {
accessSync, accessSync,
chmodSync, chmodSync,
constants as fsConstants, constants as fsConstants,
lstatSync,
mkdtempSync,
readdirSync, readdirSync,
readFileSync,
rmSync,
statSync statSync
} from 'fs'; } from 'fs';
import path from 'path'; import path from 'path';
@@ -33,9 +37,25 @@ interface ReleaseIndexResponse {
'releases-index': ReleaseIndexEntry[]; 'releases-index': ReleaseIndexEntry[];
} }
interface RuntimeReleasesResponse {
releases?: {
runtime?: {version?: string} | null;
'aspnetcore-runtime'?: {version?: string} | null;
}[];
}
const QUALITY_INPUT_MINIMAL_MAJOR_TAG = 6; const QUALITY_INPUT_MINIMAL_MAJOR_TAG = 6;
const LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG = 5; const LATEST_PATCH_SYNTAX_MINIMAL_MAJOR_TAG = 5;
function hasAspNetCoreRuntime(version: string): boolean {
const match = version.match(/^(\d+)\.(\d+)/);
return (
!match ||
Number(match[1]) > 2 ||
(Number(match[1]) === 2 && Number(match[2]) >= 1)
);
}
function channelForMajor(major: string): string { function channelForMajor(major: string): string {
// Starting with .NET 5, the minor version is always zero. // Starting with .NET 5, the minor version is always zero.
// Hardcode the earlier versions because they will not get new releases. // Hardcode the earlier versions because they will not get new releases.
@@ -347,11 +367,97 @@ export abstract class DotnetInstallDir {
windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet') windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet')
}; };
public static readonly dirPath = process.env['DOTNET_INSTALL_DIR'] private static resolvedDirPath: string | undefined;
? DotnetInstallDir.convertInstallPathToAbsolute(
// Resolved on first use so a job that installs nothing never touches the disk.
public static get dirPath(): string {
DotnetInstallDir.resolvedDirPath ??= DotnetInstallDir.resolveDirPath();
return DotnetInstallDir.resolvedDirPath;
}
private static resolveDirPath(): string {
if (process.env['DOTNET_INSTALL_DIR']) {
return DotnetInstallDir.convertInstallPathToAbsolute(
process.env['DOTNET_INSTALL_DIR'] process.env['DOTNET_INSTALL_DIR']
) );
: DotnetInstallDir.default[PLATFORM]; }
const systemPath = DotnetInstallDir.default[PLATFORM];
const homePath = DotnetInstallDir.homeInstallPath();
// A relative default (unset HOME/PROGRAMFILES) would probe the cwd.
if (
path.isAbsolute(systemPath) &&
DotnetInstallDir.isWritableLocation(systemPath)
) {
return systemPath;
}
// On macOS both candidates are the same path, already probed above.
const hasFallback = !!homePath && homePath !== systemPath;
if (hasFallback && DotnetInstallDir.isWritableLocation(homePath!)) {
core.warning(
`The default .NET install directory '${systemPath}' is not writable by the current user. Falling back to '${homePath}'; .NET preinstalled in the default location will no longer be used. Set the DOTNET_INSTALL_DIR environment variable to override this location.`
);
return homePath!;
}
// Not setFailed: the install may still succeed, so let it report the error.
core.warning(
hasFallback
? `Neither the default .NET install directory '${systemPath}' nor '${homePath}' is writable by the current user. Keeping '${systemPath}', but the installation is likely to fail. Set the DOTNET_INSTALL_DIR environment variable to a writable location.`
: `The default .NET install directory '${systemPath}' is not writable by the current user. Keeping it, but the installation is likely to fail. Set the DOTNET_INSTALL_DIR environment variable to a writable location.`
);
return systemPath;
}
private static homeInstallPath(): string | undefined {
try {
const home = os.homedir();
// An empty HOME resolves against the cwd; a root HOME gives '/.dotnet'.
if (!path.isAbsolute(home) || home === path.parse(home).root) {
return undefined;
}
return path.join(home, '.dotnet');
} catch {
return undefined;
}
}
// Writability is tested by creating a directory. accessSync is not enough: it
// ignores Windows ACLs, so it reports success where the install would fail.
private static isWritableLocation(installDir: string): boolean {
let existingPath = path.resolve(installDir);
try {
// lstat also matches a broken symlink. existsSync does not, and the walk
// would skip past it to a writable parent and wrongly report success.
while (!lstatSync(existingPath, {throwIfNoEntry: false})) {
const parentPath = path.dirname(existingPath);
if (parentPath === existingPath) return false;
existingPath = parentPath;
}
} catch {
return false;
}
let probeDir: string | undefined;
try {
probeDir = mkdtempSync(path.join(existingPath, '.setup-dotnet-probe-'));
return true;
} catch {
return false;
} finally {
if (probeDir) {
try {
rmSync(probeDir, {recursive: true, force: true});
} catch {
// Throwing here would discard the result already returned above.
}
}
}
}
private static convertInstallPathToAbsolute(installDir: string): string { private static convertInstallPathToAbsolute(installDir: string): string {
if (path.isAbsolute(installDir)) return path.normalize(installDir); if (path.isAbsolute(installDir)) return path.normalize(installDir);
@@ -410,10 +516,6 @@ function isExecutableFile(filePath: string): boolean {
export class DotnetCoreInstaller { export class DotnetCoreInstaller {
private static readonly FeatureBandSyntax = /^(\d+)\.(\d+)\.(\d)xx$/; private static readonly FeatureBandSyntax = /^(\d+)\.(\d+)\.(\d)xx$/;
static {
DotnetInstallDir.setEnvironmentVariable();
}
constructor( constructor(
private version: string, private version: string,
private quality: QualityOptions, private quality: QualityOptions,
@@ -615,6 +717,10 @@ export class DotnetCoreInstaller {
); );
} }
return this.findMatchingVersion(allowed);
}
private findMatchingVersion(allowed: string[]): string | null {
if (semver.valid(this.version)) { if (semver.valid(this.version)) {
return allowed.find(version => version === this.version) ?? null; return allowed.find(version => version === this.version) ?? null;
} }
@@ -686,7 +792,71 @@ export class DotnetCoreInstaller {
return null; return null;
} }
private getInstalledRuntimeVersions(framework: string): string[] {
const runtimeDir = path.join(DotnetInstallDir.dirPath, 'shared', framework);
try {
return readdirSync(runtimeDir, {withFileTypes: true})
.filter(entry => entry.isDirectory() || entry.isSymbolicLink())
.map(entry => entry.name)
.filter(version => semver.valid(version) !== null)
.filter(version =>
isFile(path.join(runtimeDir, version, `${framework}.deps.json`))
);
} catch {
core.debug(`Unable to read the runtime directory '${runtimeDir}'.`);
return [];
}
}
private findLocalRuntimeVersion(): string | null {
if (!this.hasDotnetMuxer()) {
return null;
}
const dotnetVersions = this.getInstalledRuntimeVersions(
'Microsoft.NETCore.App'
);
const aspnetVersions = this.getInstalledRuntimeVersions(
'Microsoft.AspNetCore.App'
);
// Preview pairs can have different build numbers, so a preview ASP.NET Core
// runtime is paired with the .NET runtime declared in its runtimeconfig.json.
const pairedVersions = new Set([
...aspnetVersions,
...aspnetVersions
.filter(version => semver.prerelease(version))
.flatMap(version => this.getDeclaredRuntimeVersion(version) ?? [])
]);
return this.findMatchingVersion(
dotnetVersions.filter(
version => !hasAspNetCoreRuntime(version) || pairedVersions.has(version)
)
);
}
private getDeclaredRuntimeVersion(aspnetVersion: string): string | undefined {
const configPath = path.join(
DotnetInstallDir.dirPath,
'shared',
'Microsoft.AspNetCore.App',
aspnetVersion,
'Microsoft.AspNetCore.App.runtimeconfig.json'
);
try {
const framework = JSON.parse(readFileSync(configPath, 'utf8'))
.runtimeOptions?.framework;
return framework?.name === 'Microsoft.NETCore.App'
? framework.version
: undefined;
} catch {
core.debug(`Unable to read the runtime pairing from '${configPath}'.`);
return undefined;
}
}
public async installDotnet(): Promise<string | null> { public async installDotnet(): Promise<string | null> {
// Before findLocalSdkVersion(), which looks under the resolved directory.
DotnetInstallDir.setEnvironmentVariable();
const isCrossArch = const isCrossArch =
!!this.architecture && !!this.architecture &&
normalizeArch(this.architecture) !== normalizeArch(os.arch()); normalizeArch(this.architecture) !== normalizeArch(os.arch());
@@ -775,6 +945,161 @@ export class DotnetCoreInstaller {
return this.parseInstalledVersion(dotnetInstallOutput.stdout); return this.parseInstalledVersion(dotnetInstallOutput.stdout);
} }
public async installRuntime(): Promise<string | null> {
this.validateRuntimeVersion();
DotnetInstallDir.setEnvironmentVariable();
const isCrossArch =
!!this.architecture &&
normalizeArch(this.architecture) !== normalizeArch(os.arch());
if (!this.checkLatest && !isCrossArch) {
const localVersion = this.findLocalRuntimeVersion();
if (localVersion) {
core.info(
`'check-latest' is false and locally installed .NET runtimes (${localVersion}) satisfy the '${this.version}' request. Skipping download.`
);
return localVersion;
}
core.info(
`'check-latest' is false but no complete local runtime installation satisfies the '${this.version}' request. Falling back to online installation.`
);
}
const versionResolver = new DotnetVersionResolver(
this.version,
this.quality,
this.dotnetChannel
);
const dotnetVersion = await versionResolver.createDotnetVersion();
if (this.quality && !dotnetVersion.qualityFlag) {
core.warning(
`The 'dotnet-quality' input can be used only with .NET runtime channels in A.B, A.B.x, A or A.x formats where the major tag is higher than 5, or 'latest' resolving to such a channel. You specified: ${dotnetVersion.value}. 'dotnet-quality' input is ignored for this runtime.`
);
}
const installAspNetCore = hasAspNetCoreRuntime(dotnetVersion.value);
const aspnetVersion = installAspNetCore
? await this.resolveAspNetCoreVersion(dotnetVersion)
: undefined;
if (!installAspNetCore) {
core.warning(
`ASP.NET Core shared runtimes are not available before .NET Core 2.1. Installing only the .NET runtime for '${this.version}'.`
);
}
const architectureArguments = isCrossArch
? [
IS_WINDOWS ? '-InstallDir' : '--install-dir',
IS_WINDOWS
? `"${path.join(DotnetInstallDir.dirPath, this.architecture!)}"`
: path.join(DotnetInstallDir.dirPath, this.architecture!)
]
: [];
// Install the .NET runtime (Microsoft.NETCore.App) first, then the
// ASP.NET Core runtime (Microsoft.AspNetCore.App)
const dotnetRuntimeStdout = await this.installSharedRuntime(
'dotnet',
dotnetVersion,
architectureArguments
);
if (aspnetVersion) {
await this.installSharedRuntime(
'aspnetcore',
aspnetVersion,
architectureArguments
);
}
// The output remains the base runtime version, even when build numbers differ.
return this.parseInstalledVersion(dotnetRuntimeStdout);
}
// Runs before the resolver, whose errors name 'dotnet-version'.
private validateRuntimeVersion(): void {
if (
this.version.toLowerCase() === 'latest' ||
semver.validRange(this.version)
) {
return;
}
// Feature bands (A.B.Cxx) exist only for SDKs, so the install script can't resolve them for runtimes.
const reason = DotnetCoreInstaller.FeatureBandSyntax.test(this.version)
? ` The A.B.Cxx feature band syntax applies only to .NET SDKs and is supported only by 'dotnet-version'.`
: '';
throw new Error(
`The 'dotnet-runtime' was supplied in invalid format: ${this.version}!${reason} Supported syntax: A.B.C, A.B, A.B.x, A, A.x, latest`
);
}
private async resolveAspNetCoreVersion(
dotnetVersion: DotnetVersion
): Promise<DotnetVersion> {
const version = dotnetVersion.value;
if (!semver.valid(version) || !semver.prerelease(version)) {
return dotnetVersion;
}
const channel = `${semver.major(version)}.${semver.minor(version)}`;
const httpClient = new hc.HttpClient('actions/setup-dotnet', [], {
allowRetries: true,
maxRetries: 3
});
try {
const response = await httpClient.getJson<RuntimeReleasesResponse>(
`https://builds.dotnet.microsoft.com/dotnet/release-metadata/${channel}/releases.json`
);
const releases = response.result?.releases;
const release = Array.isArray(releases)
? releases.find(entry => entry?.runtime?.version === version)
: undefined;
const aspnetVersion = release?.['aspnetcore-runtime']?.version;
if (
response.statusCode === 200 &&
typeof aspnetVersion === 'string' &&
semver.valid(aspnetVersion)
) {
return {...dotnetVersion, value: aspnetVersion};
}
core.warning(
`No ASP.NET Core release mapping was found for '${version}' (HTTP ${response.statusCode}). Trying the same exact version for this potentially unpublished build; installation failures remain fatal.`
);
} catch (error) {
core.warning(
`Unable to resolve the ASP.NET Core release paired with '${version}': ${error instanceof Error ? error.message : String(error)}. Trying the same exact version; installation failures remain fatal.`
);
} finally {
httpClient.dispose();
}
return dotnetVersion;
}
private async installSharedRuntime(
runtime: 'dotnet' | 'aspnetcore',
dotnetVersion: DotnetVersion,
architectureArguments: string[]
): Promise<string> {
const runtimeInstallOutput = await new DotnetInstallScript()
.useArchitecture(this.architecture)
// If dotnet CLI is already installed - avoid overwriting it
.useArguments(
IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files'
)
.useArguments(IS_WINDOWS ? '-Runtime' : '--runtime', runtime)
// Use version provided by user
.useVersion(dotnetVersion, dotnetVersion.qualityFlag ? this.quality : '')
.useArguments(...architectureArguments)
.execute();
if (runtimeInstallOutput.exitCode) {
throw new Error(
`Failed to install ${runtime} runtime, exit code: ${runtimeInstallOutput.exitCode}. ${runtimeInstallOutput.stderr}`
);
}
return runtimeInstallOutput.stdout;
}
private parseInstalledVersion(stdout: string): string | null { private parseInstalledVersion(stdout: string): string | null {
const regex = /(?<version>\d+\.\d+\.\d+[a-z0-9._-]*)/gm; const regex = /(?<version>\d+\.\d+\.\d+[a-z0-9._-]*)/gm;
const matchedResult = regex.exec(stdout); const matchedResult = regex.exec(stdout);

View File

@@ -49,6 +49,7 @@ export async function run() {
// //
// dotnet-version is optional, but needs to be provided for most use cases. // dotnet-version is optional, but needs to be provided for most use cases.
// If supplied, install / use from the tool cache. // If supplied, install / use from the tool cache.
// dotnet-runtime is optional and allows installing runtime-only versions.
// global-version-file may be specified to point to a specific global.json // global-version-file may be specified to point to a specific global.json
// and will be used to install an additional version. // and will be used to install an additional version.
// If not supplied, look for version in ./global.json. // If not supplied, look for version in ./global.json.
@@ -71,12 +72,13 @@ export async function run() {
globalJsonConstraints.set(version, {minimumVersion, rollForward}); globalJsonConstraints.set(version, {minimumVersion, rollForward});
} }
}; };
const runtimeVersions = core.getMultilineInput('dotnet-runtime');
const installedDotnetVersions: (string | null)[] = []; const installedDotnetVersions: (string | null)[] = [];
const architecture = getArchitectureInput(); const architecture = getArchitectureInput();
const checkLatest = getCheckLatestInput(); const checkLatest = getCheckLatestInput();
let dotnetChannel = core.getInput('dotnet-channel'); let dotnetChannel = core.getInput('dotnet-channel');
const isLatestRequested = versions.some( const isLatestRequested = [...versions, ...runtimeVersions].some(
version => version && version.toLowerCase() === 'latest' version => version && version.toLowerCase() === 'latest'
); );
if (dotnetChannel && !isValidChannel(dotnetChannel)) { if (dotnetChannel && !isValidChannel(dotnetChannel)) {
@@ -92,7 +94,7 @@ export async function run() {
} }
} else if (dotnetChannel && !isLatestRequested) { } else if (dotnetChannel && !isLatestRequested) {
core.warning( core.warning(
`The 'dotnet-channel' input is only supported when 'dotnet-version' is set to 'latest'.` `The 'dotnet-channel' input is only supported when 'dotnet-version' or 'dotnet-runtime' is set to 'latest'.`
); );
dotnetChannel = ''; dotnetChannel = '';
} }
@@ -114,22 +116,26 @@ export async function run() {
const globalJsonPath = path.join(process.cwd(), 'global.json'); const globalJsonPath = path.join(process.cwd(), 'global.json');
if (fs.existsSync(globalJsonPath)) { if (fs.existsSync(globalJsonPath)) {
addVersionFromGlobalJson(globalJsonPath); addVersionFromGlobalJson(globalJsonPath);
} else { } else if (!runtimeVersions.length) {
core.info( core.info(
`The global.json wasn't found in the root directory. No .NET version will be installed.` `The global.json wasn't found in the root directory. No .NET version will be installed.`
); );
} }
} }
const quality = core.getInput('dotnet-quality') as QualityOptions;
if (
(versions.length || runtimeVersions.length) &&
quality &&
!qualityOptions.includes(quality)
) {
throw new Error(
`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, preview, ga.`
);
}
if (versions.length) { if (versions.length) {
const quality = core.getInput('dotnet-quality') as QualityOptions;
if (quality && !qualityOptions.includes(quality)) {
throw new Error(
`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, preview, ga.`
);
}
const skipLtsPrepass = core.getBooleanInput('skip-lts-prepass'); const skipLtsPrepass = core.getBooleanInput('skip-lts-prepass');
let dotnetInstaller: DotnetCoreInstaller; let dotnetInstaller: DotnetCoreInstaller;
@@ -151,15 +157,7 @@ export async function run() {
const installedVersion = await dotnetInstaller.installDotnet(); const installedVersion = await dotnetInstaller.installDotnet();
installedDotnetVersions.push(installedVersion); installedDotnetVersions.push(installedVersion);
} }
if ( setDotnetInstallDir(architecture);
architecture &&
normalizeArch(architecture) !== normalizeArch(os.arch())
) {
process.env['DOTNET_INSTALL_DIR'] = path.join(
DotnetInstallDir.dirPath,
architecture
);
}
DotnetInstallDir.addToPath(); DotnetInstallDir.addToPath();
const workloadsInput = core.getInput('workloads'); const workloadsInput = core.getInput('workloads');
@@ -186,6 +184,30 @@ export async function run() {
} }
} }
if (runtimeVersions.length) {
const uniqueRuntimeVersions = new Set<string>(
runtimeVersions.map(v => (v.toLowerCase() === 'latest' ? 'latest' : v))
);
// Runtimes have no SDK feature bands, so A.B.Cxx uses its A.B channel.
const runtimeChannel = dotnetChannel.replace(/^(\d+\.\d+)\.\dxx$/, '$1');
for (const runtimeVersion of uniqueRuntimeVersions) {
const dotnetInstaller = new DotnetCoreInstaller(
runtimeVersion,
quality,
architecture,
runtimeVersion === 'latest' ? runtimeChannel : undefined,
checkLatest
);
await dotnetInstaller.installRuntime();
}
// installRuntime() resets DOTNET_INSTALL_DIR to the base directory.
setDotnetInstallDir(architecture);
// The SDK installation has already added the same directory to PATH.
if (!versions.length) {
DotnetInstallDir.addToPath();
}
}
const sourceUrl: string = core.getInput('source-url'); const sourceUrl: string = core.getInput('source-url');
const configFile: string = core.getInput('config-file'); const configFile: string = core.getInput('config-file');
if (sourceUrl) { if (sourceUrl) {
@@ -211,6 +233,18 @@ export async function run() {
} }
} }
function setDotnetInstallDir(architecture: SupportedArchitecture | ''): void {
if (
architecture &&
normalizeArch(architecture) !== normalizeArch(os.arch())
) {
process.env['DOTNET_INSTALL_DIR'] = path.join(
DotnetInstallDir.dirPath,
architecture
);
}
}
function getArchitectureInput(): SupportedArchitecture | '' { function getArchitectureInput(): SupportedArchitecture | '' {
const raw = (core.getInput('architecture') || '').trim(); const raw = (core.getInput('architecture') || '').trim();
if (!raw) return ''; if (!raw) return '';