description:'Set up a specific version of the .NET Core CLI in the PATH and set up authentication to a private NuGet repository'
description:'Used to build and publish .NET source. Set up a specific version of the .NET Core CLI in the PATH and set up authentication to a private NuGet repository'
author:'GitHub'
branding:
icon:play
color:green
inputs:
dotnet-version:
description: 'SDK version to use. Examples:2.2.104,3.1,3.1.x'
description: 'Optional SDK version to use. If not provided, will install global.json version when available. Examples:2.2.104,3.1,3.1.x'
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:
description:'Optional OWNER for using packages from GitHub Package Registry organizations/users other than the current repository''s owner. Only used if a GPR URL is also provided in source-url'
config-file:
description:'Optional NuGet.config location, if your NuGet.config isn''t located in the root of the repo.'
include-prerelease:
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.'
console.log(`dotnet-auth: Finding any source references in ${existingFileLocation}, writing a new temporary configuration file with credentials to ${tempFileLocation}`);
letxml;
@ -4910,8 +4925,8 @@ function writeFeedToFile(feedUrl, existingFileLocation, tempFileLocation) {
}
xml=xml.ele('packageSourceCredentials');
sourceKeys.forEach(key=>{
if(key.indexOf(' ')>-1){
thrownewError("This action currently can't handle source names with spaces. Remove the space from your repo's NuGet.config and try again.");
if(!isValidKey(key)){
thrownewError("Source name can contain letters, numbers, and '-', '_', '.' symbols only. Please, fix source name in NuGet.config and try again.");
}
xml=xml
.ele(key)
@ -7814,14 +7829,18 @@ function run() {
core.debug('No version found, trying to find version from global.json');
say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/sdk/issues"
say_err "Architecture \`$architecture\` not supported. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues"
return1
}
# args:
# user_defined_os - $1
get_normalized_os(){
eval$invocation
localosname="$(to_lowercase "$1")"
if[ ! -z "$osname"];then
case"$osname" in
osx | freebsd | rhel.6 | linux-musl | linux)
echo"$osname"
return0
;;
*)
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."
return1
;;
esac
else
osname="$(get_current_os_name)"||return1
fi
echo"$osname"
return0
}
# args:
# quality - $1
get_normalized_quality(){
eval$invocation
localquality="$(to_lowercase "$1")"
if[ ! -z "$quality"];then
case"$quality" in
daily | signed | validated | preview)
echo"$quality"
return0
;;
ga)
#ga quality is available without specifying quality, so normalizing it to empty
return0
;;
*)
say_err "'$quality' is not a supported value for --quality option. Supported values are: daily, signed, validated, preview, ga. If you think this is a bug, report it at https://github.com/dotnet/install-scripts/issues."
return1
;;
esac
fi
return0
}
# args:
# channel - $1
get_normalized_channel(){
eval$invocation
localchannel="$(to_lowercase "$1")"
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
if[ ! -z "$channel"];then
case"$channel" in
lts)
echo"LTS"
return0
;;
*)
echo"$channel"
return0
;;
esac
fi
return0
}
# args:
# runtime - $1
get_normalized_product(){
eval$invocation
localruntime="$(to_lowercase "$1")"
if[["$runtime"=="dotnet"]];then
product="dotnet-runtime"
elif[["$runtime"=="aspnetcore"]];then
product="aspnetcore-runtime"
elif[ -z "$runtime"];then
product="dotnet-sdk"
fi
echo"$product"
return0
}
# The version text returned from the feeds is a 1-line or 2-line string:
#do not pass credentials as a part of the $aka_ms_link and do not apply credentials in the get_http_header function
#otherwise the redirect link would have credentials as well
#it would result in applying credentials twice to the resulting link and thus breaking it, and in echoing credentials to the output as a part of redirect link
# if quality is specified - exit with error - there is no fallback approach
if[ ! -z "$normalized_quality"];then
say_err "Failed to locate the latest version in the channel '$normalized_channel' with '$normalized_quality' quality for '$normalized_product', os: '$normalized_os', architecture: '$normalized_architecture'."
say_err "Refer to: https://aka.ms/dotnet-os-lifecycle for information on .NET Core support."
return1
fi
say_verbose "Falling back to latest.version file approach."
else
say_verbose "Retrieved primary payload URL from aka.ms link: '$aka_ms_download_link'."
download_link=$aka_ms_download_link
say_verbose "Downloading using legacy url will not be attempted."
# 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.
@ -869,12 +1283,14 @@ install_dotnet() {
fi
# Check if the standard SDK version is installed.
say_verbose "Checking installation: version = $specific_version"
if is_dotnet_package_installed "$install_root""$asset_relative_path""$specific_version";then
say_verbose "Checking installation: version = $specific_product_version"
if is_dotnet_package_installed "$install_root""$asset_relative_path""$specific_product_version";then
return0
fi
say_err "\`$asset_name\` with version = $specific_version failed to install with an unknown error."
# Version verification failed. More likely something is wrong either with the downloaded content or with the verification algorithm.
say_err "Failed to verify the version of installed \`$asset_name\`.\nInstallation source: $download_link.\nInstallation location: $install_root.\nReport the bug at https://github.com/dotnet/install-scripts/issues."
say_err "\`$asset_name\` with version = $specific_product_version failed to install with an unknown error."
return1
}
@ -898,8 +1314,11 @@ feed_credential=""
verbose=false
runtime=""
runtime_id=""
quality=""
internal=false
override_non_versioned_files=true
non_dynamic_parameters=""
user_defined_os=""
while[$# -ne 0]
do
@ -913,6 +1332,14 @@ do
shift
version="$1"
;;
-q|--quality|-[Qq]uality)
shift
quality="$1"
;;
--internal|-[Ii]nternal)
internal=true
non_dynamic_parameters+="$name"
;;
-i|--install-dir|-[Ii]nstall[Dd]ir)
shift
install_dir="$1"
@ -921,6 +1348,10 @@ do
shift
architecture="$1"
;;
--os|-[Oo][SS])
shift
user_defined_os="$1"
;;
--shared-runtime|-[Ss]hared[Rr]untime)
say_warning "The --shared-runtime flag is obsolete and may be removed in a future version of this script. The recommended usage is to specify '--runtime dotnet'."
if[ -z "$runtime"];then
@ -966,12 +1397,15 @@ do
--feed-credential|-[Ff]eed[Cc]redential)
shift
feed_credential="$1"
non_dynamic_parameters+="$name"\""$1"\"""
#feed_credential should start with "?", for it to be added to the end of the link.
#adding "?" at the beginning of the feed_credential if needed.
say_warning "Use of --runtime-id is obsolete and should be limited to the versions below 2.1. To override architecture, use --architecture option instead. To override OS, use --os option instead."
;;
--jsonfile|-[Jj][Ss]on[Ff]ile)
shift
@ -997,22 +1431,36 @@ do
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" - Branch name"
echo" examples: release/2.0.0; Master"
echo" Note: The version parameter overrides the channel parameter."
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" 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 - most latest build on specific channel"
echo" - coherent - most latest coherent build on specific channel"
echo" coherent applies only to SDK downloads"
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 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."
echo" --azure-feed,-AzureFeed Azure feed location. Defaults to $azure_feed, This parameter typically is not changed by the user."
echo" --uncached-feed,-UncachedFeed Uncached feed location. This parameter typically is not changed by the user."
echo" --feed-credential,-FeedCredential Azure feed shared access token. This parameter typically is not specified."
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" --runtime-id Installs the .NET Tools for the given platform (use linux-x64 for portable linux)."
echo" -RuntimeId"
echo" -?,--?,-h,--help,-Help Shows this help message"
echo""
echo"Obsolete parameters:"
echo" --shared-runtime The recommended alternative is '--runtime dotnet'."
echo" This parameter is obsolete and may be removed in a future version of this script."
echo" Installs just the shared runtime bits, not the entire SDK."
echo" --runtime-id Installs the .NET Tools for the given platform (use linux-x64 for portable linux)."
echo" -RuntimeId" The parameter is obsolete and may be removed in a future version of this script. Should be used only for versions below 2.1.
echo" For primary links to override OS or/and architecture, use --os and --architecture option instead."
echo""
echo"Install Location:"
echo" Location is chosen in following order:"
@ -1058,28 +1506,53 @@ if [ "$no_cdn" = true ]; then
azure_feed="$uncached_feed"
fi
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"
say "Binaries of dotnet can be found in $bin_path"
fi
say "Note that the script does not resolve dependencies during installation."
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."