mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-08-20 07:35:10 +00:00
DOTNET_ROOT and short generic versions
This commit is contained in:
parent
9d7c66c348
commit
981175578b
11
dist/index.js
vendored
11
dist/index.js
vendored
@ -16797,14 +16797,15 @@ class DotNetVersionInfo {
|
|||||||
constructor(version) {
|
constructor(version) {
|
||||||
this.isExactVersionSet = false;
|
this.isExactVersionSet = false;
|
||||||
this.inputVersion = version;
|
this.inputVersion = version;
|
||||||
// Check for exact match
|
//Note: No support for previews when using generic
|
||||||
if (semver.valid(semver.clean(version) || '') != null) {
|
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.fullversion = semver.clean(version);
|
||||||
this.isExactVersionSet = true;
|
this.isExactVersionSet = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Note: No support for previews when using generic
|
|
||||||
let parts = version.split('.');
|
|
||||||
if (parts.length < 2 || parts.length > 3)
|
if (parts.length < 2 || parts.length > 3)
|
||||||
this.throwInvalidVersionFormat();
|
this.throwInvalidVersionFormat();
|
||||||
if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') {
|
if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') {
|
||||||
@ -16916,6 +16917,7 @@ class DotnetCoreInstaller {
|
|||||||
}
|
}
|
||||||
if (process.env['DOTNET_INSTALL_DIR']) {
|
if (process.env['DOTNET_INSTALL_DIR']) {
|
||||||
core.addPath(process.env['DOTNET_INSTALL_DIR']);
|
core.addPath(process.env['DOTNET_INSTALL_DIR']);
|
||||||
|
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
@ -16926,6 +16928,7 @@ class DotnetCoreInstaller {
|
|||||||
else {
|
else {
|
||||||
// This is the default set in install-dotnet.sh
|
// This is the default set in install-dotnet.sh
|
||||||
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
|
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
|
||||||
|
core.exportVariable('DOTNET_ROOT', path.join(process.env['HOME'] + '', '.dotnet'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(process.env['PATH']);
|
console.log(process.env['PATH']);
|
||||||
|
@ -21,17 +21,20 @@ export class DotNetVersionInfo {
|
|||||||
constructor(version: string) {
|
constructor(version: string) {
|
||||||
this.inputVersion = version;
|
this.inputVersion = version;
|
||||||
|
|
||||||
// Check for exact match
|
//Note: No support for previews when using generic
|
||||||
if (semver.valid(semver.clean(version) || '') != null) {
|
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.fullversion = semver.clean(version) as string;
|
||||||
this.isExactVersionSet = true;
|
this.isExactVersionSet = true;
|
||||||
|
|
||||||
return;
|
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 < 2 || parts.length > 3) this.throwInvalidVersionFormat();
|
||||||
|
|
||||||
if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') {
|
if (parts.length == 3 && parts[2] !== 'x' && parts[2] !== '*') {
|
||||||
@ -163,6 +166,7 @@ export class DotnetCoreInstaller {
|
|||||||
|
|
||||||
if (process.env['DOTNET_INSTALL_DIR']) {
|
if (process.env['DOTNET_INSTALL_DIR']) {
|
||||||
core.addPath(process.env['DOTNET_INSTALL_DIR']);
|
core.addPath(process.env['DOTNET_INSTALL_DIR']);
|
||||||
|
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
|
||||||
} else {
|
} else {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
// This is the default set in install-dotnet.ps1
|
// This is the default set in install-dotnet.ps1
|
||||||
@ -176,6 +180,10 @@ export class DotnetCoreInstaller {
|
|||||||
} else {
|
} else {
|
||||||
// This is the default set in install-dotnet.sh
|
// This is the default set in install-dotnet.sh
|
||||||
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
|
core.addPath(path.join(process.env['HOME'] + '', '.dotnet'));
|
||||||
|
core.exportVariable(
|
||||||
|
'DOTNET_ROOT',
|
||||||
|
path.join(process.env['HOME'] + '', '.dotnet')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user