DOTNET_ROOT and short generic versions

This commit is contained in:
Zachary Eisinger 2020-09-22 07:15:21 -07:00
parent 9d7c66c348
commit 981175578b
2 changed files with 20 additions and 9 deletions

11
dist/index.js vendored
View File

@ -16797,14 +16797,15 @@ class DotNetVersionInfo {
constructor(version) {
this.isExactVersionSet = false;
this.inputVersion = version;
// Check for exact match
if (semver.valid(semver.clean(version) || '') != null) {
//Note: No support for previews when using generic
let parts = version.split('.');
// Check for exact match, and that there are at least 3 parts to the version (preview/rc versions have more than 3 parts)
if (semver.valid(semver.clean(version) || '') != null &&
parts.length >= 3) {
this.fullversion = semver.clean(version);
this.isExactVersionSet = true;
return;
}
//Note: No support for previews when using generic
let parts = version.split('.');
if (parts.length < 2 || parts.length > 3)
this.throwInvalidVersionFormat();
if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') {
@ -16916,6 +16917,7 @@ class DotnetCoreInstaller {
}
if (process.env['DOTNET_INSTALL_DIR']) {
core.addPath(process.env['DOTNET_INSTALL_DIR']);
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
}
else {
if (IS_WINDOWS) {
@ -16926,6 +16928,7 @@ class DotnetCoreInstaller {
else {
// This is the default set in install-dotnet.sh
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
core.exportVariable('DOTNET_ROOT', path.join(process.env['HOME'] + '', '.dotnet'));
}
}
console.log(process.env['PATH']);

View File

@ -21,17 +21,20 @@ export class DotNetVersionInfo {
constructor(version: string) {
this.inputVersion = version;
// Check for exact match
if (semver.valid(semver.clean(version) || '') != null) {
//Note: No support for previews when using generic
let parts: string[] = version.split('.');
// Check for exact match, and that there are at least 3 parts to the version (preview/rc versions have more than 3 parts)
if (
semver.valid(semver.clean(version) || '') != null &&
parts.length >= 3
) {
this.fullversion = semver.clean(version) as string;
this.isExactVersionSet = true;
return;
}
//Note: No support for previews when using generic
let parts: string[] = version.split('.');
if (parts.length < 2 || parts.length > 3) this.throwInvalidVersionFormat();
if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') {
@ -163,6 +166,7 @@ export class DotnetCoreInstaller {
if (process.env['DOTNET_INSTALL_DIR']) {
core.addPath(process.env['DOTNET_INSTALL_DIR']);
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
} else {
if (IS_WINDOWS) {
// This is the default set in install-dotnet.ps1
@ -176,6 +180,10 @@ export class DotnetCoreInstaller {
} else {
// This is the default set in install-dotnet.sh
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
core.exportVariable(
'DOTNET_ROOT',
path.join(process.env['HOME'] + '', '.dotnet')
);
}
}