mirror of
https://github.com/actions/setup-dotnet.git
synced 2024-11-22 11:31:07 +07:00
Update docs to v2 (#278)
* Update docs to v2 * Bump checkout action to v3 * Update installer scripts * Replace v2 to vX on the docs, minor fixes * Remove extra whitespace
This commit is contained in:
parent
9211491ffb
commit
53d632b5c0
7
.github/workflows/check-dist.yml
vendored
7
.github/workflows/check-dist.yml
vendored
@ -21,12 +21,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set Node.js 16
|
- name: Set Node.js 16
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
|
cache: npm
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
@ -44,7 +45,7 @@ jobs:
|
|||||||
id: diff
|
id: diff
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
# If index.js was different than expected, upload the expected version as an artifact
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v3
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
|
2
.github/workflows/licensed.yml
vendored
2
.github/workflows/licensed.yml
vendored
@ -14,7 +14,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Check licenses
|
name: Check licenses
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- name: Install licensed
|
- name: Install licensed
|
||||||
run: |
|
run: |
|
||||||
|
2
.github/workflows/test-dotnet.yml
vendored
2
.github/workflows/test-dotnet.yml
vendored
@ -21,7 +21,7 @@ jobs:
|
|||||||
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0']
|
dotnet-version: ['2.1', '2.2', '3.0', '3.1', '5.0']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Clear toolcache
|
- name: Clear toolcache
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
|
18
.github/workflows/workflow.yml
vendored
18
.github/workflows/workflow.yml
vendored
@ -20,9 +20,9 @@ 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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Set Node.js 16
|
- name: Set Node.js 16
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
cache: npm
|
cache: npm
|
||||||
@ -42,7 +42,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Clear toolcache
|
- name: Clear toolcache
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
@ -65,7 +65,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Clear toolcache
|
- name: Clear toolcache
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
@ -98,7 +98,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Clear toolcache
|
- name: Clear toolcache
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
@ -123,7 +123,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Clear toolcache
|
- name: Clear toolcache
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
@ -147,7 +147,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@v2
|
uses: actions/checkout@v3
|
||||||
- name: Clear toolcache
|
- name: Clear toolcache
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
run: __tests__/clear-toolcache.ps1 ${{ runner.os }}
|
||||||
@ -178,7 +178,7 @@ jobs:
|
|||||||
http_proxy: http://squid-proxy:3128
|
http_proxy: http://squid-proxy:3128
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Clear tool cache
|
- name: Clear tool cache
|
||||||
run: rm -rf "/usr/share/dotnet"
|
run: rm -rf "/usr/share/dotnet"
|
||||||
- name: Install curl
|
- name: Install curl
|
||||||
@ -202,7 +202,7 @@ jobs:
|
|||||||
no_proxy: github.com,dotnetcli.blob.core.windows.net,download.visualstudio.microsoft.com,api.nuget.org,dotnetcli.azureedge.net
|
no_proxy: github.com,dotnetcli.blob.core.windows.net,download.visualstudio.microsoft.com,api.nuget.org,dotnetcli.azureedge.net
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v3
|
||||||
- name: Clear tool cache
|
- name: Clear tool cache
|
||||||
run: rm -rf "/usr/share/dotnet"
|
run: rm -rf "/usr/share/dotnet"
|
||||||
- name: Setup dotnet 3.1.201
|
- name: Setup dotnet 3.1.201
|
||||||
|
36
README.md
36
README.md
@ -1,8 +1,6 @@
|
|||||||
# setup-dotnet
|
# setup-dotnet
|
||||||
|
|
||||||
<p align="left">
|
[![GitHub Actions Status](https://github.com/actions/setup-dotnet/workflows/Main%20workflow/badge.svg)](https://github.com/actions/setup-dotnet)
|
||||||
<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>
|
|
||||||
|
|
||||||
This action sets up a [.NET CLI](https://github.com/dotnet/sdk) environment for use in actions by:
|
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:
|
Basic:
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel
|
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>
|
- run: dotnet build <my project>
|
||||||
@ -34,9 +32,9 @@ Multiple versions:
|
|||||||
|
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: |
|
dotnet-version: |
|
||||||
3.1.x
|
3.1.x
|
||||||
@ -46,8 +44,8 @@ steps:
|
|||||||
Preview version:
|
Preview version:
|
||||||
```yml
|
```yml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: '6.0.x'
|
dotnet-version: '6.0.x'
|
||||||
include-prerelease: true
|
include-prerelease: true
|
||||||
@ -64,9 +62,9 @@ jobs:
|
|||||||
dotnet: [ '2.1.x', '3.1.x', '5.0.x' ]
|
dotnet: [ '2.1.x', '3.1.x', '5.0.x' ]
|
||||||
name: Dotnet ${{ matrix.dotnet }} sample
|
name: Dotnet ${{ matrix.dotnet }} sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: ${{ matrix.dotnet }}
|
dotnet-version: ${{ matrix.dotnet }}
|
||||||
- run: dotnet build <my project>
|
- run: dotnet build <my project>
|
||||||
@ -79,13 +77,13 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Dotnet Side by Side testing sample
|
name: Dotnet Side by Side testing sample
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: '2.1.x'
|
dotnet-version: '2.1.x'
|
||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.x'
|
dotnet-version: '3.1.x'
|
||||||
- run: dotnet build <my project>
|
- run: dotnet build <my project>
|
||||||
@ -95,9 +93,9 @@ jobs:
|
|||||||
Authentication for nuget feeds:
|
Authentication for nuget feeds:
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
# Authenticates packages to push to GPR
|
# Authenticates packages to push to GPR
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.x' # SDK Version to use.
|
dotnet-version: '3.1.x' # SDK Version to use.
|
||||||
source-url: https://nuget.pkg.github.com/<owner>/index.json
|
source-url: https://nuget.pkg.github.com/<owner>/index.json
|
||||||
@ -110,7 +108,7 @@ steps:
|
|||||||
run: dotnet nuget push <my project>/bin/Release/*.nupkg
|
run: dotnet nuget push <my project>/bin/Release/*.nupkg
|
||||||
|
|
||||||
# Authenticates packages to push to Azure Artifacts
|
# Authenticates packages to push to Azure Artifacts
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
source-url: https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/nuget/v3/index.json
|
source-url: https://pkgs.dev.azure.com/<your-organization>/_packaging/<your-feed-name>/nuget/v3/index.json
|
||||||
env:
|
env:
|
||||||
@ -120,7 +118,7 @@ steps:
|
|||||||
|
|
||||||
# Authenticates packages to push to nuget.org.
|
# 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.
|
# 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:
|
with:
|
||||||
dotnet-version: 3.1.x
|
dotnet-version: 3.1.x
|
||||||
- name: Publish the package to nuget.org
|
- name: Publish the package to nuget.org
|
||||||
@ -145,7 +143,7 @@ build:
|
|||||||
DOTNET_NOLOGO: true
|
DOTNET_NOLOGO: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@main
|
- uses: actions/checkout@main
|
||||||
- uses: actions/setup-dotnet@v1
|
- uses: actions/setup-dotnet@v2
|
||||||
with:
|
with:
|
||||||
dotnet-version: '3.1.x' # SDK Version to use.
|
dotnet-version: '3.1.x' # SDK Version to use.
|
||||||
```
|
```
|
||||||
|
@ -26,9 +26,15 @@ With any contribution please take time to consider how this can be tested to mai
|
|||||||
## Creating new version
|
## Creating new version
|
||||||
|
|
||||||
Details on versioning can be found here: https://github.com/actions/toolkit/blob/main/docs/action-versioning.md
|
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.
|
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 v1 tag needs to be updated as well.
|
Once the new release is created, the vX tag needs to be updated as well.
|
||||||
```
|
```
|
||||||
git tag -fa v1 -m "Update v1 tag"
|
git tag -fa vX -m "Update vX tag"
|
||||||
git push origin v1 --force
|
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
|
||||||
```
|
```
|
49
externals/install-dotnet.sh
vendored
49
externals/install-dotnet.sh
vendored
@ -637,11 +637,13 @@ get_specific_product_version() {
|
|||||||
|
|
||||||
if machine_has "curl"
|
if machine_has "curl"
|
||||||
then
|
then
|
||||||
specific_product_version=$(curl -s --fail "${download_link}${feed_credential}" 2>&1)
|
if ! specific_product_version=$(curl -s --fail "${download_link}${feed_credential}" 2>&1); then
|
||||||
if [ $? = 0 ]; then
|
continue
|
||||||
|
else
|
||||||
echo "${specific_product_version//[$'\t\r\n']}"
|
echo "${specific_product_version//[$'\t\r\n']}"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
elif machine_has "wget"
|
elif machine_has "wget"
|
||||||
then
|
then
|
||||||
specific_product_version=$(wget -qO- "${download_link}${feed_credential}" 2>&1)
|
specific_product_version=$(wget -qO- "${download_link}${feed_credential}" 2>&1)
|
||||||
@ -921,9 +923,15 @@ get_http_header_wget() {
|
|||||||
local remote_path="$1"
|
local remote_path="$1"
|
||||||
local disable_feed_credential="$2"
|
local disable_feed_credential="$2"
|
||||||
local wget_options="-q -S --spider --tries 5 "
|
local wget_options="-q -S --spider --tries 5 "
|
||||||
# Store options that aren't supported on all wget implementations separately.
|
|
||||||
local wget_options_extra="--waitretry 2 --connect-timeout 15 "
|
local wget_options_extra=''
|
||||||
local wget_result=''
|
|
||||||
|
# Test for options that aren't supported on all wget implementations.
|
||||||
|
if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then
|
||||||
|
wget_options_extra="--waitretry 2 --connect-timeout 15 "
|
||||||
|
else
|
||||||
|
say "wget extra options are unavailable for this environment"
|
||||||
|
fi
|
||||||
|
|
||||||
remote_path_with_credential="$remote_path"
|
remote_path_with_credential="$remote_path"
|
||||||
if [ "$disable_feed_credential" = false ]; then
|
if [ "$disable_feed_credential" = false ]; then
|
||||||
@ -931,15 +939,8 @@ get_http_header_wget() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
wget $wget_options $wget_options_extra "$remote_path_with_credential" 2>&1
|
wget $wget_options $wget_options_extra "$remote_path_with_credential" 2>&1
|
||||||
wget_result=$?
|
|
||||||
|
|
||||||
if [[ $wget_result == 2 ]]; then
|
return $?
|
||||||
# Parsing of the command has failed. Exclude potentially unrecognized options and retry.
|
|
||||||
wget $wget_options "$remote_path_with_credential" 2>&1
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
|
|
||||||
return $wget_result
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# args:
|
# args:
|
||||||
@ -1030,10 +1031,17 @@ downloadwget() {
|
|||||||
# Append feed_credential as late as possible before calling wget to avoid logging feed_credential
|
# Append feed_credential as late as possible before calling wget to avoid logging feed_credential
|
||||||
local remote_path_with_credential="${remote_path}${feed_credential}"
|
local remote_path_with_credential="${remote_path}${feed_credential}"
|
||||||
local wget_options="--tries 20 "
|
local wget_options="--tries 20 "
|
||||||
# Store options that aren't supported on all wget implementations separately.
|
|
||||||
local wget_options_extra="--waitretry 2 --connect-timeout 15 "
|
local wget_options_extra=''
|
||||||
local wget_result=''
|
local wget_result=''
|
||||||
|
|
||||||
|
# Test for options that aren't supported on all wget implementations.
|
||||||
|
if [[ $(wget -h 2>&1 | grep -E 'waitretry|connect-timeout') ]]; then
|
||||||
|
wget_options_extra="--waitretry 2 --connect-timeout 15 "
|
||||||
|
else
|
||||||
|
say "wget extra options are unavailable for this environment"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -z "$out_path" ]; then
|
if [ -z "$out_path" ]; then
|
||||||
wget -q $wget_options $wget_options_extra -O - "$remote_path_with_credential" 2>&1
|
wget -q $wget_options $wget_options_extra -O - "$remote_path_with_credential" 2>&1
|
||||||
wget_result=$?
|
wget_result=$?
|
||||||
@ -1042,17 +1050,6 @@ downloadwget() {
|
|||||||
wget_result=$?
|
wget_result=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $wget_result == 2 ]]; then
|
|
||||||
# Parsing of the command has failed. Exclude potentially unrecognized options and retry.
|
|
||||||
if [ -z "$out_path" ]; then
|
|
||||||
wget -q $wget_options -O - "$remote_path_with_credential" 2>&1
|
|
||||||
wget_result=$?
|
|
||||||
else
|
|
||||||
wget $wget_options -O "$out_path" "$remote_path_with_credential" 2>&1
|
|
||||||
wget_result=$?
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $wget_result != 0 ]]; then
|
if [[ $wget_result != 0 ]]; then
|
||||||
local disable_feed_credential=false
|
local disable_feed_credential=false
|
||||||
local response=$(get_http_header_wget $remote_path $disable_feed_credential)
|
local response=$(get_http_header_wget $remote_path $disable_feed_credential)
|
||||||
|
Loading…
Reference in New Issue
Block a user