You've already forked setup-dotnet
mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-09-13 16:24:06 +07:00
Add option to install runtime only
This commit is contained in:
@ -255,7 +255,8 @@ export class DotnetCoreInstaller {
|
||||
|
||||
constructor(
|
||||
private readonly dotnetVersion: DotnetVersion,
|
||||
private readonly quality: QualityOptions
|
||||
private readonly quality: QualityOptions,
|
||||
private readonly runtimeOnly = false
|
||||
) {}
|
||||
|
||||
public async installDotnet(): Promise<string | null> {
|
||||
@ -288,14 +289,22 @@ export class DotnetCoreInstaller {
|
||||
* Install dotnet over the latest version of
|
||||
* dotnet CLI
|
||||
*/
|
||||
const dotnetInstallOutput = await new DotnetInstallScript()
|
||||
const dotnetInstallScript = new DotnetInstallScript()
|
||||
// Don't overwrite CLI because it should be already installed
|
||||
.useArguments(
|
||||
IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files'
|
||||
)
|
||||
// Use version provided by user
|
||||
.useVersion(this.dotnetVersion, this.quality)
|
||||
.execute();
|
||||
.useVersion(this.dotnetVersion, this.quality);
|
||||
|
||||
if (this.runtimeOnly) {
|
||||
dotnetInstallScript.useArguments(
|
||||
IS_WINDOWS ? '-Runtime' : '--runtime',
|
||||
'dotnet'
|
||||
);
|
||||
}
|
||||
|
||||
const dotnetInstallOutput = await dotnetInstallScript.execute();
|
||||
|
||||
if (dotnetInstallOutput.exitCode) {
|
||||
throw new Error(
|
||||
|
@ -78,7 +78,8 @@ export async function run() {
|
||||
dotnetVersionResolver = new DotnetVersionResolver(version);
|
||||
dotnetInstaller = new DotnetCoreInstaller(
|
||||
await dotnetVersionResolver.createDotnetVersion(),
|
||||
quality
|
||||
quality,
|
||||
core.getBooleanInput('runtime-only')
|
||||
);
|
||||
const installedVersion = await dotnetInstaller.installDotnet();
|
||||
installedDotnetVersions.push(installedVersion);
|
||||
|
Reference in New Issue
Block a user