Explicity set installation path
Github actions tool guidelines, is to use the worker tool cache, instead of system-wide install path.
This commit is contained in:
parent
4d6c8fcf3c
commit
efeedaa0ba
|
@ -93164,6 +93164,13 @@ class DotnetInstallScript {
|
||||||
this.scriptArguments.push(...args);
|
this.scriptArguments.push(...args);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
useInstallPath(installPath) {
|
||||||
|
if (installPath == null) {
|
||||||
|
installPath = DotnetInstallDir.dirPath;
|
||||||
|
}
|
||||||
|
this.useArguments(utils_1.IS_WINDOWS ? '-Install-Dir' : '--install-dir', installPath);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
useVersion(dotnetVersion, quality) {
|
useVersion(dotnetVersion, quality) {
|
||||||
if (dotnetVersion.type) {
|
if (dotnetVersion.type) {
|
||||||
this.useArguments(dotnetVersion.type, dotnetVersion.value);
|
this.useArguments(dotnetVersion.type, dotnetVersion.value);
|
||||||
|
@ -93189,6 +93196,15 @@ class DotnetInstallScript {
|
||||||
}
|
}
|
||||||
exports.DotnetInstallScript = DotnetInstallScript;
|
exports.DotnetInstallScript = DotnetInstallScript;
|
||||||
class DotnetInstallDir {
|
class DotnetInstallDir {
|
||||||
|
static getInstallDirectory() {
|
||||||
|
if (process.env['DOTNET_INSTALL_DIR'] != null) {
|
||||||
|
return process.env['DOTNET_INSTALL_DIR'];
|
||||||
|
}
|
||||||
|
if (process.env['RUNNER_TOOL_CACHE'] != null) {
|
||||||
|
return path_1.default.join(process.env['RUNNER_TOOL_CACHE'], 'dotnet');
|
||||||
|
}
|
||||||
|
return DotnetInstallDir.default[utils_1.PLATFORM];
|
||||||
|
}
|
||||||
static convertInstallPathToAbsolute(installDir) {
|
static convertInstallPathToAbsolute(installDir) {
|
||||||
if (path_1.default.isAbsolute(installDir))
|
if (path_1.default.isAbsolute(installDir))
|
||||||
return path_1.default.normalize(installDir);
|
return path_1.default.normalize(installDir);
|
||||||
|
@ -93211,9 +93227,7 @@ DotnetInstallDir.default = {
|
||||||
mac: path_1.default.join(process.env['HOME'] + '', '.dotnet'),
|
mac: path_1.default.join(process.env['HOME'] + '', '.dotnet'),
|
||||||
windows: path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet')
|
windows: path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet')
|
||||||
};
|
};
|
||||||
DotnetInstallDir.dirPath = process.env['DOTNET_INSTALL_DIR']
|
DotnetInstallDir.dirPath = DotnetInstallDir.convertInstallPathToAbsolute(DotnetInstallDir.getInstallDirectory());
|
||||||
? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR'])
|
|
||||||
: DotnetInstallDir.default[utils_1.PLATFORM];
|
|
||||||
class DotnetCoreInstaller {
|
class DotnetCoreInstaller {
|
||||||
constructor(version, quality) {
|
constructor(version, quality) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
|
@ -93234,6 +93248,8 @@ class DotnetCoreInstaller {
|
||||||
.useArguments(utils_1.IS_WINDOWS ? '-Runtime' : '--runtime', 'dotnet')
|
.useArguments(utils_1.IS_WINDOWS ? '-Runtime' : '--runtime', 'dotnet')
|
||||||
// Use latest stable version
|
// Use latest stable version
|
||||||
.useArguments(utils_1.IS_WINDOWS ? '-Channel' : '--channel', 'LTS')
|
.useArguments(utils_1.IS_WINDOWS ? '-Channel' : '--channel', 'LTS')
|
||||||
|
// Explicitly set the install path (see https://github.com/actions/setup-dotnet/issues/360)
|
||||||
|
.useInstallPath(DotnetInstallDir.dirPath)
|
||||||
.execute();
|
.execute();
|
||||||
if (runtimeInstallOutput.exitCode) {
|
if (runtimeInstallOutput.exitCode) {
|
||||||
/**
|
/**
|
||||||
|
@ -93251,6 +93267,8 @@ class DotnetCoreInstaller {
|
||||||
.useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files')
|
.useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files')
|
||||||
// Use version provided by user
|
// Use version provided by user
|
||||||
.useVersion(dotnetVersion, this.quality)
|
.useVersion(dotnetVersion, this.quality)
|
||||||
|
// Explicitly set the install path (see https://github.com/actions/setup-dotnet/issues/360)
|
||||||
|
.useInstallPath(DotnetInstallDir.dirPath)
|
||||||
.execute();
|
.execute();
|
||||||
if (dotnetInstallOutput.exitCode) {
|
if (dotnetInstallOutput.exitCode) {
|
||||||
throw new Error(`Failed to install dotnet, exit code: ${dotnetInstallOutput.exitCode}. ${dotnetInstallOutput.stderr}`);
|
throw new Error(`Failed to install dotnet, exit code: ${dotnetInstallOutput.exitCode}. ${dotnetInstallOutput.stderr}`);
|
||||||
|
|
|
@ -182,6 +182,17 @@ export class DotnetInstallScript {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public useInstallPath(installPath: string) {
|
||||||
|
if (installPath == null) {
|
||||||
|
installPath = DotnetInstallDir.dirPath;
|
||||||
|
}
|
||||||
|
this.useArguments(
|
||||||
|
IS_WINDOWS ? '-Install-Dir' : '--install-dir',
|
||||||
|
installPath
|
||||||
|
);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public useVersion(dotnetVersion: DotnetVersion, quality?: QualityOptions) {
|
public useVersion(dotnetVersion: DotnetVersion, quality?: QualityOptions) {
|
||||||
if (dotnetVersion.type) {
|
if (dotnetVersion.type) {
|
||||||
this.useArguments(dotnetVersion.type, dotnetVersion.value);
|
this.useArguments(dotnetVersion.type, dotnetVersion.value);
|
||||||
|
@ -222,11 +233,20 @@ export abstract class DotnetInstallDir {
|
||||||
windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet')
|
windows: path.join(process.env['PROGRAMFILES'] + '', 'dotnet')
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly dirPath = process.env['DOTNET_INSTALL_DIR']
|
private static getInstallDirectory() {
|
||||||
? DotnetInstallDir.convertInstallPathToAbsolute(
|
if (process.env['DOTNET_INSTALL_DIR'] != null) {
|
||||||
process.env['DOTNET_INSTALL_DIR']
|
return process.env['DOTNET_INSTALL_DIR'];
|
||||||
)
|
}
|
||||||
: DotnetInstallDir.default[PLATFORM];
|
if (process.env['RUNNER_TOOL_CACHE'] != null) {
|
||||||
|
return path.join(process.env['RUNNER_TOOL_CACHE'], 'dotnet');
|
||||||
|
}
|
||||||
|
return DotnetInstallDir.default[PLATFORM];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static readonly dirPath =
|
||||||
|
DotnetInstallDir.convertInstallPathToAbsolute(
|
||||||
|
DotnetInstallDir.getInstallDirectory()
|
||||||
|
);
|
||||||
|
|
||||||
private static convertInstallPathToAbsolute(installDir: string): string {
|
private static convertInstallPathToAbsolute(installDir: string): string {
|
||||||
if (path.isAbsolute(installDir)) return path.normalize(installDir);
|
if (path.isAbsolute(installDir)) return path.normalize(installDir);
|
||||||
|
@ -275,6 +295,8 @@ export class DotnetCoreInstaller {
|
||||||
.useArguments(IS_WINDOWS ? '-Runtime' : '--runtime', 'dotnet')
|
.useArguments(IS_WINDOWS ? '-Runtime' : '--runtime', 'dotnet')
|
||||||
// Use latest stable version
|
// Use latest stable version
|
||||||
.useArguments(IS_WINDOWS ? '-Channel' : '--channel', 'LTS')
|
.useArguments(IS_WINDOWS ? '-Channel' : '--channel', 'LTS')
|
||||||
|
// Explicitly set the install path (see https://github.com/actions/setup-dotnet/issues/360)
|
||||||
|
.useInstallPath(DotnetInstallDir.dirPath)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
if (runtimeInstallOutput.exitCode) {
|
if (runtimeInstallOutput.exitCode) {
|
||||||
|
@ -298,6 +320,8 @@ export class DotnetCoreInstaller {
|
||||||
)
|
)
|
||||||
// Use version provided by user
|
// Use version provided by user
|
||||||
.useVersion(dotnetVersion, this.quality)
|
.useVersion(dotnetVersion, this.quality)
|
||||||
|
// Explicitly set the install path (see https://github.com/actions/setup-dotnet/issues/360)
|
||||||
|
.useInstallPath(DotnetInstallDir.dirPath)
|
||||||
.execute();
|
.execute();
|
||||||
|
|
||||||
if (dotnetInstallOutput.exitCode) {
|
if (dotnetInstallOutput.exitCode) {
|
||||||
|
|
Loading…
Reference in New Issue