You've already forked setup-dotnet
mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-07-10 00:50:33 +07:00
Compare commits
15 Commits
add-publis
...
v2.1.0
Author | SHA1 | Date | |
---|---|---|---|
c0d4ad69d8 | |||
afe2daba1f | |||
5cc895510b | |||
158737d5b1 | |||
fcf565ec50 | |||
f078482971 | |||
0fb87b12d2 | |||
4fe7a196b5 | |||
9283a8cf7a | |||
53d632b5c0 | |||
9211491ffb | |||
edfd7b3266 | |||
9744af7b74 | |||
7016f85f93 | |||
d292011f5d |
11
.github/workflows/check-dist.yml
vendored
11
.github/workflows/check-dist.yml
vendored
@ -21,12 +21,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set Node.js 12.x
|
||||
uses: actions/setup-node@v1
|
||||
- name: Set Node.js 16
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 12.x
|
||||
node-version: 16.x
|
||||
cache: npm
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
@ -44,7 +45,7 @@ jobs:
|
||||
id: diff
|
||||
|
||||
# If index.js was different than expected, upload the expected version as an artifact
|
||||
- uses: actions/upload-artifact@v4
|
||||
- uses: actions/upload-artifact@v3
|
||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||
with:
|
||||
name: dist
|
||||
|
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
70
.github/workflows/codeql-analysis.yml
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
# For most projects, this workflow file will not need changing; you simply need
|
||||
# to commit it to your repository.
|
||||
#
|
||||
# You may wish to alter this file to override the set of languages analyzed,
|
||||
# or to provide custom queries or build logic.
|
||||
#
|
||||
# ******** NOTE ********
|
||||
# We have attempted to detect the languages in your repository. Please check
|
||||
# the `language` matrix defined below to confirm you have the correct set of
|
||||
# supported CodeQL languages.
|
||||
#
|
||||
name: "CodeQL"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main ]
|
||||
pull_request:
|
||||
# The branches below must be a subset of the branches above
|
||||
branches: [ main ]
|
||||
schedule:
|
||||
- cron: '23 19 * * 0'
|
||||
|
||||
jobs:
|
||||
analyze:
|
||||
name: Analyze
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
actions: read
|
||||
contents: read
|
||||
security-events: write
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: [ 'javascript' ]
|
||||
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
|
||||
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# If you wish to specify custom queries, you can do so here or in a config file.
|
||||
# By default, queries listed here will override any specified in a config file.
|
||||
# Prefix the list here with "+" to use these queries and those in the config file.
|
||||
# queries: ./path/to/local/query, your-org/your-repo/queries@main
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
4
.github/workflows/licensed.yml
vendored
4
.github/workflows/licensed.yml
vendored
@ -14,12 +14,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Check licenses
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- run: npm ci
|
||||
- name: Install licensed
|
||||
run: |
|
||||
cd $RUNNER_TEMP
|
||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.3.1/licensed-3.3.1-linux-x64.tar.gz
|
||||
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
|
||||
sudo tar -xzf licensed.tar.gz
|
||||
sudo mv licensed /usr/local/bin/licensed
|
||||
- run: licensed status
|
||||
|
20
.github/workflows/publish-immutable-action.yml
vendored
20
.github/workflows/publish-immutable-action.yml
vendored
@ -1,20 +0,0 @@
|
||||
name: 'Publish Immutable Action Version'
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checking out
|
||||
uses: actions/checkout@v4
|
||||
- name: Publish
|
||||
id: publish
|
||||
uses: actions/publish-immutable-action@v0.0.4
|
4
.github/workflows/test-dotnet.yml
vendored
4
.github/workflows/test-dotnet.yml
vendored
@ -17,11 +17,11 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0']
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
|
75
.github/workflows/workflow.yml
vendored
75
.github/workflows/workflow.yml
vendored
@ -17,14 +17,15 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-22.04, windows-latest, macos-13]
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Set Node.js 12
|
||||
uses: actions/setup-node@v1
|
||||
uses: actions/checkout@v3
|
||||
- name: Set Node.js 16
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 12.x
|
||||
node-version: 16.x
|
||||
cache: npm
|
||||
- run: npm ci
|
||||
- run: npm run build
|
||||
- run: npm run format-check
|
||||
@ -38,10 +39,10 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
@ -61,10 +62,10 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-22.04, windows-latest, macos-13]
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
@ -94,10 +95,10 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
@ -119,10 +120,10 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
@ -143,10 +144,10 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-22.04, windows-latest, macOS-latest]
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
@ -162,30 +163,54 @@ jobs:
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 3.1 2.2
|
||||
|
||||
test-setup-global-json-specified-and-version:
|
||||
runs-on: ${{ matrix.operating-system }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Clear toolcache
|
||||
shell: pwsh
|
||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||
- name: Write global.json
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir subdirectory
|
||||
echo '{"sdk":{"version": "2.2","rollForward": "latestFeature"}}' > ./subdirectory/global.json
|
||||
- name: Setup dotnet
|
||||
uses: ./
|
||||
with:
|
||||
dotnet-version: 3.1
|
||||
global-json-file: ./subdirectory/global.json
|
||||
- name: Verify dotnet
|
||||
shell: pwsh
|
||||
run: __tests__/verify-dotnet.ps1 2.2 3.1
|
||||
|
||||
test-proxy:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ubuntu:22.04
|
||||
image: mcr.microsoft.com/dotnet/core/runtime-deps:3.0-bionic
|
||||
options: --dns 127.0.0.1
|
||||
services:
|
||||
squid-proxy:
|
||||
image: ubuntu/squid:latest
|
||||
image: datadog/squid:latest
|
||||
ports:
|
||||
- 3128:3128
|
||||
env:
|
||||
https_proxy: http://squid-proxy:3128
|
||||
http_proxy: http://squid-proxy:3128
|
||||
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Clear tool cache
|
||||
run: rm -rf "/usr/share/dotnet"
|
||||
- name: Install curl
|
||||
run: |
|
||||
apt update
|
||||
apt -y install curl libssl-dev
|
||||
apt -y install curl
|
||||
- name: Setup dotnet 3.1.201
|
||||
uses: ./
|
||||
with:
|
||||
@ -197,13 +222,13 @@ jobs:
|
||||
run: __tests__/verify-dotnet.sh 3.1.201
|
||||
|
||||
test-bypass-proxy:
|
||||
runs-on: ubuntu-22.04
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
https_proxy: http://no-such-proxy:3128
|
||||
no_proxy: github.com,download.visualstudio.microsoft.com,api.nuget.org,builds.dotnet.microsoft.com,ci.dot.net
|
||||
no_proxy: github.com,dotnetcli.blob.core.windows.net,download.visualstudio.microsoft.com,api.nuget.org,dotnetcli.azureedge.net
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
- name: Clear tool cache
|
||||
run: rm -rf "/usr/share/dotnet"
|
||||
- name: Setup dotnet 3.1.201
|
||||
|
2
.licenses/npm/node-fetch.dep.yml
generated
2
.licenses/npm/node-fetch.dep.yml
generated
@ -1,6 +1,6 @@
|
||||
---
|
||||
name: node-fetch
|
||||
version: 2.6.1
|
||||
version: 2.6.7
|
||||
type: npm
|
||||
summary: A light-weight module that brings window.fetch to node.js
|
||||
homepage: https://github.com/bitinn/node-fetch
|
||||
|
30
.licenses/npm/tr46.dep.yml
generated
Normal file
30
.licenses/npm/tr46.dep.yml
generated
Normal file
@ -0,0 +1,30 @@
|
||||
---
|
||||
name: tr46
|
||||
version: 0.0.3
|
||||
type: npm
|
||||
summary: An implementation of the Unicode TR46 spec
|
||||
homepage: https://github.com/Sebmaster/tr46.js#readme
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: Auto-generated MIT license text
|
||||
text: |
|
||||
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: []
|
23
.licenses/npm/webidl-conversions.dep.yml
generated
Normal file
23
.licenses/npm/webidl-conversions.dep.yml
generated
Normal file
@ -0,0 +1,23 @@
|
||||
---
|
||||
name: webidl-conversions
|
||||
version: 3.0.1
|
||||
type: npm
|
||||
summary: Implements the WebIDL algorithms for converting to and from JavaScript values
|
||||
homepage:
|
||||
license: bsd-2-clause
|
||||
licenses:
|
||||
- sources: LICENSE.md
|
||||
text: |
|
||||
# The BSD 2-Clause License
|
||||
|
||||
Copyright (c) 2014, Domenic Denicola
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
notices: []
|
32
.licenses/npm/whatwg-url.dep.yml
generated
Normal file
32
.licenses/npm/whatwg-url.dep.yml
generated
Normal file
@ -0,0 +1,32 @@
|
||||
---
|
||||
name: whatwg-url
|
||||
version: 5.0.0
|
||||
type: npm
|
||||
summary: An implementation of the WHATWG URL Standard's URL API and parsing machinery
|
||||
homepage:
|
||||
license: mit
|
||||
licenses:
|
||||
- sources: LICENSE.txt
|
||||
text: |
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015–2016 Sebastian Mayr
|
||||
|
||||
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: []
|
76
CODE_OF_CONDUCT.md
Normal file
76
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,76 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as
|
||||
contributors and maintainers pledge to make participation in our project and
|
||||
our community a harassment-free experience for everyone, regardless of age, body
|
||||
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
||||
level of experience, education, socio-economic status, nationality, personal
|
||||
appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment
|
||||
include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||
advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic
|
||||
address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable
|
||||
behavior and are expected to take appropriate and fair corrective action in
|
||||
response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or
|
||||
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||
permanently any contributor for other behaviors that they deem inappropriate,
|
||||
threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all project spaces, and it also applies when
|
||||
an individual is representing the project or its community in public spaces.
|
||||
Examples of representing a project or community include using an official
|
||||
project e-mail address, posting via an official social media account, or acting
|
||||
as an appointed representative at an online or offline event. Representation of
|
||||
a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project team at opensource+actions/setup-dotnet@github.com. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project team is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
52
README.md
52
README.md
@ -1,8 +1,6 @@
|
||||
# setup-dotnet
|
||||
|
||||
<p align="left">
|
||||
<a href="https://github.com/actions/setup-dotnet"><img alt="GitHub Actions status" src="https://github.com/actions/setup-dotnet/workflows/Main%20workflow/badge.svg"></a>
|
||||
</p>
|
||||
[](https://github.com/actions/setup-dotnet)
|
||||
|
||||
This action sets up a [.NET CLI](https://github.com/dotnet/sdk) environment for use in actions by:
|
||||
|
||||
@ -23,8 +21,8 @@ See [action.yml](action.yml)
|
||||
Basic:
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel
|
||||
- run: dotnet build <my project>
|
||||
@ -34,9 +32,9 @@ Multiple versions:
|
||||
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: |
|
||||
3.1.x
|
||||
@ -46,13 +44,23 @@ steps:
|
||||
Preview version:
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-dotnet@v1
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: '6.0.x'
|
||||
include-prerelease: true
|
||||
- run: dotnet build <my project>
|
||||
```
|
||||
global.json in a subdirectory:
|
||||
```yml
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
global-json-file: csharp/global.json
|
||||
- run: dotnet build <my project>
|
||||
working-directory: csharp
|
||||
```
|
||||
|
||||
Matrix Testing:
|
||||
```yaml
|
||||
@ -64,9 +72,9 @@ jobs:
|
||||
dotnet: [ '2.1.x', '3.1.x', '5.0.x' ]
|
||||
name: Dotnet ${{ matrix.dotnet }} sample
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: ${{ matrix.dotnet }}
|
||||
- run: dotnet build <my project>
|
||||
@ -79,15 +87,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
name: Dotnet Side by Side testing sample
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: '2.1.x'
|
||||
- name: Setup dotnet
|
||||
uses: actions/setup-dotnet@v1
|
||||
with:
|
||||
dotnet-version: '3.1.x'
|
||||
dotnet-version: |
|
||||
2.1.x
|
||||
3.1.x
|
||||
- run: dotnet build <my project>
|
||||
- run: dotnet test <my project>
|
||||
```
|
||||
@ -95,9 +101,9 @@ jobs:
|
||||
Authentication for nuget feeds:
|
||||
```yaml
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/checkout@v3
|
||||
# Authenticates packages to push to GPR
|
||||
- uses: actions/setup-dotnet@v1
|
||||
- uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: '3.1.x' # SDK Version to use.
|
||||
source-url: https://nuget.pkg.github.com/<owner>/index.json
|
||||
@ -110,7 +116,7 @@ steps:
|
||||
run: dotnet nuget push <my project>/bin/Release/*.nupkg
|
||||
|
||||
# Authenticates packages to push to Azure Artifacts
|
||||
- uses: actions/setup-dotnet@v1
|
||||
- uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
source-url: https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/nuget/v3/index.json
|
||||
env:
|
||||
@ -120,7 +126,7 @@ steps:
|
||||
|
||||
# Authenticates packages to push to nuget.org.
|
||||
# It's only the way to push a package to nuget.org feed for macOS/Linux machines due to API key config store limitations.
|
||||
- uses: actions/setup-dotnet@v1
|
||||
- uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: 3.1.x
|
||||
- name: Publish the package to nuget.org
|
||||
@ -145,7 +151,7 @@ build:
|
||||
DOTNET_NOLOGO: true
|
||||
steps:
|
||||
- uses: actions/checkout@main
|
||||
- uses: actions/setup-dotnet@v1
|
||||
- uses: actions/setup-dotnet@v2
|
||||
with:
|
||||
dotnet-version: '3.1.x' # SDK Version to use.
|
||||
```
|
||||
|
@ -7,6 +7,8 @@ branding:
|
||||
inputs:
|
||||
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'
|
||||
global-json-file:
|
||||
description: 'Optional global.json location, if your global.json isn''t located in the root of the repo.'
|
||||
source-url:
|
||||
description: 'Optional package source for which to set up authentication. Will consult any existing NuGet.config in the root of the repo and provide a temporary NuGet.config using the NUGET_AUTH_TOKEN environment variable as a ClearTextPassword'
|
||||
owner:
|
||||
@ -17,5 +19,5 @@ inputs:
|
||||
description: 'Whether prerelease versions should be matched with non-exact versions (for example 5.0.0-preview.6 being matched by 5, 5.0, 5.x or 5.0.x). Defaults to false if not provided.'
|
||||
required: False
|
||||
runs:
|
||||
using: 'node12'
|
||||
using: 'node16'
|
||||
main: 'dist/index.js'
|
||||
|
34327
dist/index.js
vendored
34327
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -26,9 +26,15 @@ With any contribution please take time to consider how this can be tested to mai
|
||||
## Creating new version
|
||||
|
||||
Details on versioning can be found here: https://github.com/actions/toolkit/blob/main/docs/action-versioning.md
|
||||
Create a new release using the UI. Version format should be `v1.x.x`. Creating a new major version requires reaction from users and should be done only with breaking changes.
|
||||
Once the new release is created, the v1 tag needs to be updated as well.
|
||||
Create a new release using the UI. Version format should be `vX.Y.Z`. Creating a new major version requires reaction from users and should be done only with breaking changes.
|
||||
Once the new release is created, the vX tag needs to be updated as well.
|
||||
```
|
||||
git tag -fa v1 -m "Update v1 tag"
|
||||
git push origin v1 --force
|
||||
git tag -fa vX -m "Update vX tag"
|
||||
git push origin vX --force
|
||||
```
|
||||
|
||||
For example, if you're publishing v2:
|
||||
```
|
||||
git tag -fa v2 -m "Update v2 tag"
|
||||
git push origin v2 --force
|
||||
```
|
3071
externals/install-dotnet.ps1
vendored
3071
externals/install-dotnet.ps1
vendored
File diff suppressed because it is too large
Load Diff
426
externals/install-dotnet.sh
vendored
426
externals/install-dotnet.sh
vendored
@ -298,43 +298,14 @@ get_machine_architecture() {
|
||||
if command -v uname > /dev/null; then
|
||||
CPUName=$(uname -m)
|
||||
case $CPUName in
|
||||
armv1*|armv2*|armv3*|armv4*|armv5*|armv6*)
|
||||
echo "armv6-or-below"
|
||||
return 0
|
||||
;;
|
||||
armv*l)
|
||||
echo "arm"
|
||||
return 0
|
||||
;;
|
||||
aarch64|arm64)
|
||||
if [ "$(getconf LONG_BIT)" -lt 64 ]; then
|
||||
# This is 32-bit OS running on 64-bit CPU (for example Raspberry Pi OS)
|
||||
echo "arm"
|
||||
return 0
|
||||
fi
|
||||
echo "arm64"
|
||||
return 0
|
||||
;;
|
||||
s390x)
|
||||
echo "s390x"
|
||||
return 0
|
||||
;;
|
||||
ppc64le)
|
||||
echo "ppc64le"
|
||||
return 0
|
||||
;;
|
||||
loongarch64)
|
||||
echo "loongarch64"
|
||||
return 0
|
||||
;;
|
||||
riscv64)
|
||||
echo "riscv64"
|
||||
return 0
|
||||
;;
|
||||
powerpc|ppc)
|
||||
echo "ppc"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@ -351,13 +322,7 @@ get_normalized_architecture_from_architecture() {
|
||||
local architecture="$(to_lowercase "$1")"
|
||||
|
||||
if [[ $architecture == \<auto\> ]]; then
|
||||
machine_architecture="$(get_machine_architecture)"
|
||||
if [[ "$machine_architecture" == "armv6-or-below" ]]; then
|
||||
say_err "Architecture \`$machine_architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo $machine_architecture
|
||||
echo "$(get_machine_architecture)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@ -374,72 +339,12 @@ get_normalized_architecture_from_architecture() {
|
||||
echo "arm64"
|
||||
return 0
|
||||
;;
|
||||
s390x)
|
||||
echo "s390x"
|
||||
return 0
|
||||
;;
|
||||
ppc64le)
|
||||
echo "ppc64le"
|
||||
return 0
|
||||
;;
|
||||
loongarch64)
|
||||
echo "loongarch64"
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues"
|
||||
return 1
|
||||
}
|
||||
|
||||
# args:
|
||||
# version - $1
|
||||
# channel - $2
|
||||
# architecture - $3
|
||||
get_normalized_architecture_for_specific_sdk_version() {
|
||||
eval $invocation
|
||||
|
||||
local is_version_support_arm64="$(is_arm64_supported "$1")"
|
||||
local is_channel_support_arm64="$(is_arm64_supported "$2")"
|
||||
local architecture="$3";
|
||||
local osname="$(get_current_os_name)"
|
||||
|
||||
if [ "$osname" == "osx" ] && [ "$architecture" == "arm64" ] && { [ "$is_version_support_arm64" = false ] || [ "$is_channel_support_arm64" = false ]; }; then
|
||||
#check if rosetta is installed
|
||||
if [ "$(/usr/bin/pgrep oahd >/dev/null 2>&1;echo $?)" -eq 0 ]; then
|
||||
say_verbose "Changing user architecture from '$architecture' to 'x64' because .NET SDKs prior to version 6.0 do not support arm64."
|
||||
echo "x64"
|
||||
return 0;
|
||||
else
|
||||
say_err "Architecture \`$architecture\` is not supported for .NET SDK version \`$version\`. Please install Rosetta to allow emulation of the \`$architecture\` .NET SDK on this platform"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "$architecture"
|
||||
return 0
|
||||
}
|
||||
|
||||
# args:
|
||||
# version or channel - $1
|
||||
is_arm64_supported() {
|
||||
# Extract the major version by splitting on the dot
|
||||
major_version="${1%%.*}"
|
||||
|
||||
# Check if the major version is a valid number and less than 6
|
||||
case "$major_version" in
|
||||
[0-9]*)
|
||||
if [ "$major_version" -lt 6 ]; then
|
||||
echo false
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
echo true
|
||||
return 0
|
||||
}
|
||||
|
||||
# args:
|
||||
# user_defined_os - $1
|
||||
get_normalized_os() {
|
||||
@ -452,13 +357,8 @@ get_normalized_os() {
|
||||
echo "$osname"
|
||||
return 0
|
||||
;;
|
||||
macos)
|
||||
osname='osx'
|
||||
echo "$osname"
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
say_err "'$user_defined_os' is not a supported value for --os option, supported values are: osx, macos, linux, linux-musl, freebsd, rhel.6. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues."
|
||||
say_err "'$user_defined_os' is not a supported value for --os option, supported values are: osx, linux, linux-musl, freebsd, rhel.6. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues."
|
||||
return 1
|
||||
;;
|
||||
esac
|
||||
@ -501,10 +401,6 @@ get_normalized_channel() {
|
||||
|
||||
local channel="$(to_lowercase "$1")"
|
||||
|
||||
if [[ $channel == current ]]; then
|
||||
say_warning 'Value "Current" is deprecated for -Channel option. Use "STS" instead.'
|
||||
fi
|
||||
|
||||
if [[ $channel == release/* ]]; then
|
||||
say_warning 'Using branch name with -Channel option is no longer supported with newer releases. Use -Quality option with a channel in X.Y format instead.';
|
||||
fi
|
||||
@ -515,14 +411,6 @@ get_normalized_channel() {
|
||||
echo "LTS"
|
||||
return 0
|
||||
;;
|
||||
sts)
|
||||
echo "STS"
|
||||
return 0
|
||||
;;
|
||||
current)
|
||||
echo "STS"
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
echo "$channel"
|
||||
return 0
|
||||
@ -588,40 +476,6 @@ is_dotnet_package_installed() {
|
||||
fi
|
||||
}
|
||||
|
||||
# args:
|
||||
# downloaded file - $1
|
||||
# remote_file_size - $2
|
||||
validate_remote_local_file_sizes()
|
||||
{
|
||||
eval $invocation
|
||||
|
||||
local downloaded_file="$1"
|
||||
local remote_file_size="$2"
|
||||
local file_size=''
|
||||
|
||||
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
||||
file_size="$(stat -c '%s' "$downloaded_file")"
|
||||
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# hardcode in order to avoid conflicts with GNU stat
|
||||
file_size="$(/usr/bin/stat -f '%z' "$downloaded_file")"
|
||||
fi
|
||||
|
||||
if [ -n "$file_size" ]; then
|
||||
say "Downloaded file size is $file_size bytes."
|
||||
|
||||
if [ -n "$remote_file_size" ] && [ -n "$file_size" ]; then
|
||||
if [ "$remote_file_size" -ne "$file_size" ]; then
|
||||
say "The remote and local file sizes are not equal. The remote file size is $remote_file_size bytes and the local size is $file_size bytes. The local package may be corrupted."
|
||||
else
|
||||
say "The remote and local file sizes are equal."
|
||||
fi
|
||||
fi
|
||||
|
||||
else
|
||||
say "Either downloaded or local package size can not be measured. One of them may be corrupted."
|
||||
fi
|
||||
}
|
||||
|
||||
# args:
|
||||
# azure_feed - $1
|
||||
# channel - $2
|
||||
@ -661,7 +515,7 @@ parse_globaljson_file_for_version() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
sdk_section=$(cat $json_file | tr -d "\r" | awk '/"sdk"/,/}/')
|
||||
sdk_section=$(cat $json_file | awk '/"sdk"/,/}/')
|
||||
if [ -z "$sdk_section" ]; then
|
||||
say_err "Unable to parse the SDK node in \`$json_file\`"
|
||||
return 1
|
||||
@ -956,37 +810,6 @@ get_absolute_path() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# args:
|
||||
# override - $1 (boolean, true or false)
|
||||
get_cp_options() {
|
||||
eval $invocation
|
||||
|
||||
local override="$1"
|
||||
local override_switch=""
|
||||
|
||||
if [ "$override" = false ]; then
|
||||
override_switch="-n"
|
||||
|
||||
# create temporary files to check if 'cp -u' is supported
|
||||
tmp_dir="$(mktemp -d)"
|
||||
tmp_file="$tmp_dir/testfile"
|
||||
tmp_file2="$tmp_dir/testfile2"
|
||||
|
||||
touch "$tmp_file"
|
||||
|
||||
# use -u instead of -n if it's available
|
||||
if cp -u "$tmp_file" "$tmp_file2" 2>/dev/null; then
|
||||
override_switch="-u"
|
||||
fi
|
||||
|
||||
# clean up
|
||||
rm -f "$tmp_file" "$tmp_file2"
|
||||
rm -rf "$tmp_dir"
|
||||
fi
|
||||
|
||||
echo "$override_switch"
|
||||
}
|
||||
|
||||
# args:
|
||||
# input_files - stdin
|
||||
# root_path - $1
|
||||
@ -998,7 +821,15 @@ copy_files_or_dirs_from_list() {
|
||||
local root_path="$(remove_trailing_slash "$1")"
|
||||
local out_path="$(remove_trailing_slash "$2")"
|
||||
local override="$3"
|
||||
local override_switch="$(get_cp_options "$override")"
|
||||
local osname="$(get_current_os_name)"
|
||||
local override_switch=$(
|
||||
if [ "$override" = false ]; then
|
||||
if [ "$osname" = "linux-musl" ]; then
|
||||
printf -- "-u";
|
||||
else
|
||||
printf -- "-n";
|
||||
fi
|
||||
fi)
|
||||
|
||||
cat | uniq | while read -r file_path; do
|
||||
local path="$(remove_beginning_slash "${file_path#$root_path}")"
|
||||
@ -1013,39 +844,14 @@ copy_files_or_dirs_from_list() {
|
||||
done
|
||||
}
|
||||
|
||||
# args:
|
||||
# zip_uri - $1
|
||||
get_remote_file_size() {
|
||||
local zip_uri="$1"
|
||||
|
||||
if machine_has "curl"; then
|
||||
file_size=$(curl -sI "$zip_uri" | grep -i content-length | awk '{ num = $2 + 0; print num }')
|
||||
elif machine_has "wget"; then
|
||||
file_size=$(wget --spider --server-response -O /dev/null "$zip_uri" 2>&1 | grep -i 'Content-Length:' | awk '{ num = $2 + 0; print num }')
|
||||
else
|
||||
say "Neither curl nor wget is available on this system."
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$file_size" ]; then
|
||||
say "Remote file $zip_uri size is $file_size bytes."
|
||||
echo "$file_size"
|
||||
else
|
||||
say_verbose "Content-Length header was not extracted for $zip_uri."
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
# args:
|
||||
# zip_path - $1
|
||||
# out_path - $2
|
||||
# remote_file_size - $3
|
||||
extract_dotnet_package() {
|
||||
eval $invocation
|
||||
|
||||
local zip_path="$1"
|
||||
local out_path="$2"
|
||||
local remote_file_size="$3"
|
||||
|
||||
local temp_out_path="$(mktemp -d "$temporary_file_template")"
|
||||
|
||||
@ -1055,13 +861,9 @@ extract_dotnet_package() {
|
||||
local folders_with_version_regex='^.*/[0-9]+\.[0-9]+[^/]+/'
|
||||
find "$temp_out_path" -type f | grep -Eo "$folders_with_version_regex" | sort | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" false
|
||||
find "$temp_out_path" -type f | grep -Ev "$folders_with_version_regex" | copy_files_or_dirs_from_list "$temp_out_path" "$out_path" "$override_non_versioned_files"
|
||||
|
||||
validate_remote_local_file_sizes "$zip_path" "$remote_file_size"
|
||||
|
||||
|
||||
rm -rf "$temp_out_path"
|
||||
if [ -z ${keep_zip+x} ]; then
|
||||
rm -f "$zip_path" && say_verbose "Temporary archive file $zip_path was removed"
|
||||
fi
|
||||
rm -f "$zip_path" && say_verbose "Temporary zip file $zip_path was removed"
|
||||
|
||||
if [ "$failed" = true ]; then
|
||||
say_err "Extraction failed"
|
||||
@ -1178,6 +980,8 @@ download() {
|
||||
sleep $((attempts*10))
|
||||
done
|
||||
|
||||
|
||||
|
||||
if [ "$failed" = true ]; then
|
||||
say_verbose "Download failed: $remote_path"
|
||||
return 1
|
||||
@ -1196,27 +1000,19 @@ downloadcurl() {
|
||||
# Avoid passing URI with credentials to functions: note, most of them echoing parameters of invocation in verbose output.
|
||||
local remote_path_with_credential="${remote_path}${feed_credential}"
|
||||
local curl_options="--retry 20 --retry-delay 2 --connect-timeout 15 -sSL -f --create-dirs "
|
||||
local curl_exit_code=0;
|
||||
local failed=false
|
||||
if [ -z "$out_path" ]; then
|
||||
curl $curl_options "$remote_path_with_credential" 2>&1
|
||||
curl_exit_code=$?
|
||||
curl $curl_options "$remote_path_with_credential" 2>&1 || failed=true
|
||||
else
|
||||
curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1
|
||||
curl_exit_code=$?
|
||||
curl $curl_options -o "$out_path" "$remote_path_with_credential" 2>&1 || failed=true
|
||||
fi
|
||||
|
||||
if [ $curl_exit_code -gt 0 ]; then
|
||||
if [ "$failed" = true ]; then
|
||||
local disable_feed_credential=false
|
||||
local response=$(get_http_header_curl $remote_path $disable_feed_credential)
|
||||
http_code=$( echo "$response" | awk '/^HTTP/{print $2}' | tail -1 )
|
||||
download_error_msg="Unable to download $remote_path."
|
||||
# Check for curl timeout codes
|
||||
if [[ $curl_exit_code == 7 || $curl_exit_code == 28 ]]; then
|
||||
download_error_msg+=" Failed to reach the server: connection timeout."
|
||||
else
|
||||
local disable_feed_credential=false
|
||||
local response=$(get_http_header_curl $remote_path $disable_feed_credential)
|
||||
http_code=$( echo "$response" | awk '/^HTTP/{print $2}' | tail -1 )
|
||||
if [[ ! -z $http_code && $http_code != 2* ]]; then
|
||||
download_error_msg+=" Returned HTTP status code: $http_code."
|
||||
fi
|
||||
if [[ $http_code != 2* ]]; then
|
||||
download_error_msg+=" Returned HTTP status code: $http_code."
|
||||
fi
|
||||
say_verbose "$download_error_msg"
|
||||
return 1
|
||||
@ -1259,11 +1055,8 @@ downloadwget() {
|
||||
local response=$(get_http_header_wget $remote_path $disable_feed_credential)
|
||||
http_code=$( echo "$response" | awk '/^ HTTP/{print $2}' | tail -1 )
|
||||
download_error_msg="Unable to download $remote_path."
|
||||
if [[ ! -z $http_code && $http_code != 2* ]]; then
|
||||
if [[ $http_code != 2* ]]; then
|
||||
download_error_msg+=" Returned HTTP status code: $http_code."
|
||||
# wget exit code 4 stands for network-issue
|
||||
elif [[ $wget_result == 4 ]]; then
|
||||
download_error_msg+=" Failed to reach the server: connection timeout."
|
||||
fi
|
||||
say_verbose "$download_error_msg"
|
||||
return 1
|
||||
@ -1272,69 +1065,13 @@ downloadwget() {
|
||||
return 0
|
||||
}
|
||||
|
||||
extract_stem() {
|
||||
local url="$1"
|
||||
# extract the protocol
|
||||
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
|
||||
# remove the protocol
|
||||
url="${1/$proto/}"
|
||||
# extract the path (if any) - since we know all of our feeds have a first path segment, we can skip the first one. otherwise we'd use -f2- to get the full path
|
||||
full_path="$(echo $url | grep / | cut -d/ -f2-)"
|
||||
path="$(echo $full_path | cut -d/ -f2-)"
|
||||
echo $path
|
||||
}
|
||||
|
||||
check_url_exists() {
|
||||
eval $invocation
|
||||
local url="$1"
|
||||
|
||||
local code=""
|
||||
if machine_has "curl"
|
||||
then
|
||||
code=$(curl --head -o /dev/null -w "%{http_code}" -s --fail "$url");
|
||||
elif machine_has "wget"
|
||||
then
|
||||
# get the http response, grab the status code
|
||||
server_response=$(wget -qO- --method=HEAD --server-response "$url" 2>&1)
|
||||
code=$(echo "$server_response" | grep "HTTP/" | awk '{print $2}')
|
||||
fi
|
||||
if [ $code = "200" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
sanitize_redirect_url() {
|
||||
eval $invocation
|
||||
|
||||
local url_stem
|
||||
url_stem=$(extract_stem "$1")
|
||||
say_verbose "Checking configured feeds for the asset at ${yellow:-}$url_stem${normal:-}"
|
||||
|
||||
for feed in "${feeds[@]}"
|
||||
do
|
||||
local trial_url="$feed/$url_stem"
|
||||
say_verbose "Checking ${yellow:-}$trial_url${normal:-}"
|
||||
if check_url_exists "$trial_url"; then
|
||||
say_verbose "Found a match at ${yellow:-}$trial_url${normal:-}"
|
||||
echo "$trial_url"
|
||||
return 0
|
||||
else
|
||||
say_verbose "No match at ${yellow:-}$trial_url${normal:-}"
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
get_download_link_from_aka_ms() {
|
||||
eval $invocation
|
||||
|
||||
#quality is not supported for LTS or STS channel
|
||||
#STS maps to current
|
||||
if [[ ! -z "$normalized_quality" && ("$normalized_channel" == "LTS" || "$normalized_channel" == "STS") ]]; then
|
||||
#quality is not supported for LTS or current channel
|
||||
if [[ ! -z "$normalized_quality" && ("$normalized_channel" == "LTS" || "$normalized_channel" == "current") ]]; then
|
||||
normalized_quality=""
|
||||
say_warning "Specifying quality for STS or LTS channel is not supported, the quality will be ignored."
|
||||
say_warning "Specifying quality for current or LTS channel is not supported, the quality will be ignored."
|
||||
fi
|
||||
|
||||
say_verbose "Retrieving primary payload URL from aka.ms for channel: '$normalized_channel', quality: '$normalized_quality', product: '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'."
|
||||
@ -1363,12 +1100,6 @@ get_download_link_from_aka_ms() {
|
||||
http_codes=$( echo "$response" | awk '$1 ~ /^HTTP/ {print $2}' )
|
||||
# They all need to be 301, otherwise some links are broken (except for the last, which is not a redirect but 200 or 404).
|
||||
broken_redirects=$( echo "$http_codes" | sed '$d' | grep -v '301' )
|
||||
# The response may end without final code 2xx/4xx/5xx somehow, e.g. network restrictions on www.bing.com causes redirecting to bing.com fails with connection refused.
|
||||
# In this case it should not exclude the last.
|
||||
last_http_code=$( echo "$http_codes" | tail -n 1 )
|
||||
if ! [[ $last_http_code =~ ^(2|4|5)[0-9][0-9]$ ]]; then
|
||||
broken_redirects=$( echo "$http_codes" | grep -v '301' )
|
||||
fi
|
||||
|
||||
# All HTTP codes are 301 (Moved Permanently), the redirect link exists.
|
||||
if [[ -z "$broken_redirects" ]]; then
|
||||
@ -1379,11 +1110,6 @@ get_download_link_from_aka_ms() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
sanitized_redirect_url=$(sanitize_redirect_url "$aka_ms_download_link")
|
||||
if [[ -n "$sanitized_redirect_url" ]]; then
|
||||
aka_ms_download_link="$sanitized_redirect_url"
|
||||
fi
|
||||
|
||||
say_verbose "The redirect location retrieved: '$aka_ms_download_link'."
|
||||
return 0
|
||||
else
|
||||
@ -1395,16 +1121,23 @@ get_download_link_from_aka_ms() {
|
||||
get_feeds_to_use()
|
||||
{
|
||||
feeds=(
|
||||
"https://builds.dotnet.microsoft.com/dotnet"
|
||||
"https://ci.dot.net/public"
|
||||
"https://dotnetcli.azureedge.net/dotnet"
|
||||
"https://dotnetbuilds.azureedge.net/public"
|
||||
)
|
||||
|
||||
if [[ -n "$azure_feed" ]]; then
|
||||
feeds=("$azure_feed")
|
||||
fi
|
||||
|
||||
if [[ -n "$uncached_feed" ]]; then
|
||||
feeds=("$uncached_feed")
|
||||
if [[ "$no_cdn" == "true" ]]; then
|
||||
feeds=(
|
||||
"https://dotnetcli.blob.core.windows.net/dotnet"
|
||||
"https://dotnetbuilds.blob.core.windows.net/public"
|
||||
)
|
||||
|
||||
if [[ -n "$uncached_feed" ]]; then
|
||||
feeds=("$uncached_feed")
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@ -1446,11 +1179,6 @@ generate_akams_links() {
|
||||
local valid_aka_ms_link=true;
|
||||
|
||||
normalized_version="$(to_lowercase "$version")"
|
||||
if [[ "$normalized_version" != "latest" ]] && [ -n "$normalized_quality" ]; then
|
||||
say_err "Quality and Version options are not allowed to be specified simultaneously. See https://learn.microsoft.com/dotnet/core/tools/dotnet-install-script#options for details."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ -n "$json_file" || "$normalized_version" != "latest" ]]; then
|
||||
# aka.ms links are not needed when exact version is specified via command or json file
|
||||
return
|
||||
@ -1536,7 +1264,7 @@ generate_regular_links() {
|
||||
link_types+=("legacy")
|
||||
else
|
||||
legacy_download_link=""
|
||||
say_verbose "Could not construct a legacy_download_link; omitting..."
|
||||
say_verbose "Cound not construct a legacy_download_link; omitting..."
|
||||
fi
|
||||
|
||||
# Check if the SDK version is already installed.
|
||||
@ -1594,8 +1322,6 @@ calculate_vars() {
|
||||
install_root="$(resolve_installation_path "$install_dir")"
|
||||
say_verbose "InstallRoot: '$install_root'."
|
||||
|
||||
normalized_architecture="$(get_normalized_architecture_for_specific_sdk_version "$version" "$normalized_channel" "$normalized_architecture")"
|
||||
|
||||
if [[ "$runtime" == "dotnet" ]]; then
|
||||
asset_relative_path="shared/Microsoft.NETCore.App"
|
||||
asset_name=".NET Core Runtime"
|
||||
@ -1614,11 +1340,10 @@ install_dotnet() {
|
||||
eval $invocation
|
||||
local download_failed=false
|
||||
local download_completed=false
|
||||
local remote_file_size=0
|
||||
|
||||
mkdir -p "$install_root"
|
||||
zip_path="${zip_path:-$(mktemp "$temporary_file_template")}"
|
||||
say_verbose "Archive path: $zip_path"
|
||||
zip_path="$(mktemp "$temporary_file_template")"
|
||||
say_verbose "Zip path: $zip_path"
|
||||
|
||||
for link_index in "${!download_links[@]}"
|
||||
do
|
||||
@ -1639,10 +1364,10 @@ install_dotnet() {
|
||||
say "The resource at $link_type link '$download_link' is not available."
|
||||
;;
|
||||
*)
|
||||
say "Failed to download $link_type link '$download_link': $http_code $download_error_msg"
|
||||
say "Failed to download $link_type link '$download_link': $download_error_msg"
|
||||
;;
|
||||
esac
|
||||
rm -f "$zip_path" 2>&1 && say_verbose "Temporary archive file $zip_path was removed"
|
||||
rm -f "$zip_path" 2>&1 && say_verbose "Temporary zip file $zip_path was removed"
|
||||
else
|
||||
download_completed=true
|
||||
break
|
||||
@ -1655,10 +1380,8 @@ install_dotnet() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
remote_file_size="$(get_remote_file_size "$download_link")"
|
||||
|
||||
say "Extracting archive from $download_link"
|
||||
extract_dotnet_package "$zip_path" "$install_root" "$remote_file_size" || return 1
|
||||
say "Extracting zip from $download_link"
|
||||
extract_dotnet_package "$zip_path" "$install_root" || return 1
|
||||
|
||||
# Check if the SDK version is installed; if not, fail the installation.
|
||||
# if the version contains "RTM" or "servicing"; check if a 'release-type' SDK version is installed.
|
||||
@ -1669,7 +1392,6 @@ install_dotnet() {
|
||||
unset IFS;
|
||||
say_verbose "Checking installation: version = $release_version"
|
||||
if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$release_version"; then
|
||||
say "Installed version is $effective_version"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
@ -1677,7 +1399,6 @@ install_dotnet() {
|
||||
# Check if the standard SDK version is installed.
|
||||
say_verbose "Checking installation: version = $effective_version"
|
||||
if is_dotnet_package_installed "$install_root" "$asset_relative_path" "$effective_version"; then
|
||||
say "Installed version is $effective_version"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@ -1700,6 +1421,7 @@ install_dir="<auto>"
|
||||
architecture="<auto>"
|
||||
dry_run=false
|
||||
no_path=false
|
||||
no_cdn=false
|
||||
azure_feed=""
|
||||
uncached_feed=""
|
||||
feed_credential=""
|
||||
@ -1772,6 +1494,10 @@ do
|
||||
verbose=true
|
||||
non_dynamic_parameters+=" $name"
|
||||
;;
|
||||
--no-cdn|-[Nn]o[Cc]dn)
|
||||
no_cdn=true
|
||||
non_dynamic_parameters+=" $name"
|
||||
;;
|
||||
--azure-feed|-[Aa]zure[Ff]eed)
|
||||
shift
|
||||
azure_feed="$1"
|
||||
@ -1803,53 +1529,36 @@ do
|
||||
override_non_versioned_files=false
|
||||
non_dynamic_parameters+=" $name"
|
||||
;;
|
||||
--keep-zip|-[Kk]eep[Zz]ip)
|
||||
keep_zip=true
|
||||
non_dynamic_parameters+=" $name"
|
||||
;;
|
||||
--zip-path|-[Zz]ip[Pp]ath)
|
||||
shift
|
||||
zip_path="$1"
|
||||
;;
|
||||
-?|--?|-h|--help|-[Hh]elp)
|
||||
script_name="dotnet-install.sh"
|
||||
script_name="$(basename "$0")"
|
||||
echo ".NET Tools Installer"
|
||||
echo "Usage:"
|
||||
echo " # Install a .NET SDK of a given Quality from a given Channel"
|
||||
echo " $script_name [-c|--channel <CHANNEL>] [-q|--quality <QUALITY>]"
|
||||
echo " # Install a .NET SDK of a specific public version"
|
||||
echo " $script_name [-v|--version <VERSION>]"
|
||||
echo "Usage: $script_name [-c|--channel <CHANNEL>] [-v|--version <VERSION>] [-p|--prefix <DESTINATION>]"
|
||||
echo " $script_name -h|-?|--help"
|
||||
echo ""
|
||||
echo "$script_name is a simple command line interface for obtaining dotnet cli."
|
||||
echo " Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:"
|
||||
echo " - The SDK needs to be installed without user interaction and without admin rights."
|
||||
echo " - The SDK installation doesn't need to persist across multiple CI runs."
|
||||
echo " To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer."
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " -c,--channel <CHANNEL> Download from the channel specified, Defaults to \`$channel\`."
|
||||
echo " -Channel"
|
||||
echo " Possible values:"
|
||||
echo " - STS - the most recent Standard Term Support release"
|
||||
echo " - LTS - the most recent Long Term Support release"
|
||||
echo " - Current - most current release"
|
||||
echo " - LTS - most current supported release"
|
||||
echo " - 2-part version in a format A.B - represents a specific release"
|
||||
echo " examples: 2.0; 1.0"
|
||||
echo " - 3-part version in a format A.B.Cxx - represents a specific SDK release"
|
||||
echo " examples: 5.0.1xx, 5.0.2xx."
|
||||
echo " Supported since 5.0 release"
|
||||
echo " Warning: Value 'Current' is deprecated for the Channel parameter. Use 'STS' instead."
|
||||
echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used."
|
||||
echo " -v,--version <VERSION> Use specific VERSION, Defaults to \`$version\`."
|
||||
echo " -Version"
|
||||
echo " Possible values:"
|
||||
echo " - latest - the latest build on specific channel"
|
||||
echo " - latest - most latest build on specific channel"
|
||||
echo " - 3-part version in a format A.B.C - represents specific version of build"
|
||||
echo " examples: 2.0.0-preview2-006120; 1.1.0"
|
||||
echo " -q,--quality <quality> Download the latest build of specified quality in the channel."
|
||||
echo " -Quality"
|
||||
echo " The possible values are: daily, signed, validated, preview, GA."
|
||||
echo " Works only in combination with channel. Not applicable for STS and LTS channels and will be ignored if those channels are used."
|
||||
echo " Works only in combination with channel. Not applicable for current and LTS channels and will be ignored if those channels are used."
|
||||
echo " For SDK use channel in A.B.Cxx format. Using quality for SDK together with channel in A.B format is not supported."
|
||||
echo " Supported since 5.0 release."
|
||||
echo " Note: The version parameter overrides the channel parameter when any version other than 'latest' is used, and therefore overrides the quality."
|
||||
@ -1860,7 +1569,7 @@ do
|
||||
echo " -InstallDir"
|
||||
echo " --architecture <ARCHITECTURE> Architecture of dotnet binaries to be installed, Defaults to \`$architecture\`."
|
||||
echo " --arch,-Architecture,-Arch"
|
||||
echo " Possible values: x64, arm, arm64, s390x, ppc64le and loongarch64"
|
||||
echo " Possible values: x64, arm, and arm64"
|
||||
echo " --os <system> Specifies operating system to be used when selecting the installer."
|
||||
echo " Overrides the OS determination approach used by the script. Supported values: osx, linux, linux-musl, freebsd, rhel.6."
|
||||
echo " In case any other value is provided, the platform will be determined by the script based on machine configuration."
|
||||
@ -1876,14 +1585,15 @@ do
|
||||
echo " --verbose,-Verbose Display diagnostics information."
|
||||
echo " --azure-feed,-AzureFeed For internal use only."
|
||||
echo " Allows using a different storage to download SDK archives from."
|
||||
echo " This parameter is only used if --no-cdn is false."
|
||||
echo " --uncached-feed,-UncachedFeed For internal use only."
|
||||
echo " Allows using a different storage to download SDK archives from."
|
||||
echo " This parameter is only used if --no-cdn is true."
|
||||
echo " --skip-non-versioned-files Skips non-versioned files if they already exist, such as the dotnet executable."
|
||||
echo " -SkipNonVersionedFiles"
|
||||
echo " --no-cdn,-NoCdn Disable downloading from the Azure CDN, and use the uncached feed directly."
|
||||
echo " --jsonfile <JSONFILE> Determines the SDK version from a user specified global.json file."
|
||||
echo " Note: global.json must have a value for 'SDK:Version'"
|
||||
echo " --keep-zip,-KeepZip If set, downloaded file is kept."
|
||||
echo " --zip-path, -ZipPath If set, downloaded file is stored at the specified path."
|
||||
echo " -?,--?,-h,--help,-Help Shows this help message"
|
||||
echo ""
|
||||
echo "Install Location:"
|
||||
@ -1902,10 +1612,10 @@ do
|
||||
shift
|
||||
done
|
||||
|
||||
say_verbose "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:"
|
||||
say_verbose "- The SDK needs to be installed without user interaction and without admin rights."
|
||||
say_verbose "- The SDK installation doesn't need to persist across multiple CI runs."
|
||||
say_verbose "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.\n"
|
||||
say "Note that the intended use of this script is for Continuous Integration (CI) scenarios, where:"
|
||||
say "- The SDK needs to be installed without user interaction and without admin rights."
|
||||
say "- The SDK installation doesn't need to persist across multiple CI runs."
|
||||
say "To set up a development environment or to run apps, use installers rather than this script. Visit https://dotnet.microsoft.com/download to get the installer.\n"
|
||||
|
||||
if [ "$internal" = true ] && [ -z "$(echo $feed_credential)" ]; then
|
||||
message="Provide credentials via --feed-credential parameter."
|
||||
@ -1938,5 +1648,5 @@ else
|
||||
fi
|
||||
|
||||
say "Note that the script does not resolve dependencies during installation."
|
||||
say "To check the list of dependencies, go to https://learn.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section."
|
||||
say "Installation finished successfully."
|
||||
say "To check the list of dependencies, go to https://docs.microsoft.com/dotnet/core/install, select your operating system and check the \"Dependencies\" section."
|
||||
say "Installation finished successfully."
|
||||
|
4895
package-lock.json
generated
4895
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -41,9 +41,9 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/node": "^12.12.62",
|
||||
"@types/node": "^16.11.25",
|
||||
"@types/semver": "^6.2.2",
|
||||
"@zeit/ncc": "^0.21.1",
|
||||
"@vercel/ncc": "^0.33.4",
|
||||
"husky": "^7.0.2",
|
||||
"jest": "^27.2.5",
|
||||
"jest-circus": "^27.2.5",
|
||||
|
@ -300,4 +300,4 @@ export class DotnetCoreInstaller {
|
||||
}
|
||||
|
||||
const DotNetCoreIndexUrl: string =
|
||||
'https://builds.dotnet.microsoft.com/dotnet/release-metadata/releases-index.json';
|
||||
'https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json';
|
||||
|
@ -9,11 +9,25 @@ export async function run() {
|
||||
//
|
||||
// dotnet-version is optional, but needs to be provided for most use cases.
|
||||
// If supplied, install / use from the tool cache.
|
||||
// global-version-file may be specified to point to a specific global.json
|
||||
// and will be used to install an additional version.
|
||||
// If not supplied, look for version in ./global.json.
|
||||
// If a valid version still can't be identified, nothing will be installed.
|
||||
// Proxy, auth, (etc) are still set up, even if no version is identified
|
||||
//
|
||||
let versions = core.getMultilineInput('dotnet-version');
|
||||
|
||||
const globalJsonFileInput = core.getInput('global-json-file');
|
||||
if (globalJsonFileInput) {
|
||||
const globalJsonPath = path.join(process.cwd(), globalJsonFileInput);
|
||||
if (!fs.existsSync(globalJsonPath)) {
|
||||
throw new Error(
|
||||
`The specified global.json file '${globalJsonFileInput}' does not exist`
|
||||
);
|
||||
}
|
||||
versions.push(getVersionFromGlobalJson(globalJsonPath));
|
||||
}
|
||||
|
||||
if (!versions.length) {
|
||||
// Try to fall back to global.json
|
||||
core.debug('No version found, trying to find version from global.json');
|
||||
|
Reference in New Issue
Block a user