mirror of
https://github.com/actions/setup-dotnet.git
synced 2024-11-22 19:41:08 +07:00
Add dotnet runtime installation before main script run
This commit is contained in:
parent
3cdb09485a
commit
8f71719d12
37
dist/setup/index.js
vendored
37
dist/setup/index.js
vendored
@ -71385,14 +71385,39 @@ class DotnetCoreInstaller {
|
|||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const versionResolver = new DotnetVersionResolver(this.version);
|
const versionResolver = new DotnetVersionResolver(this.version);
|
||||||
const dotnetVersion = yield versionResolver.createDotnetVersion();
|
const dotnetVersion = yield versionResolver.createDotnetVersion();
|
||||||
const installScript = new DotnetInstallScript()
|
/**
|
||||||
|
* Install dotnet runitme first in order to get
|
||||||
|
* the latest stable version of dotnet CLI
|
||||||
|
*/
|
||||||
|
const runtimeInstallOutput = yield new DotnetInstallScript()
|
||||||
|
// If dotnet CLI is already installed - avoid overwriting it
|
||||||
.useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files')
|
.useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files')
|
||||||
.useVersion(dotnetVersion, this.quality);
|
// Install only runtime + CLI
|
||||||
const { exitCode, stderr, stdout } = yield installScript.execute();
|
.useArguments(utils_1.IS_WINDOWS ? '-Runtime' : '--runtime', 'dotnet')
|
||||||
if (exitCode) {
|
// Use latest stable version
|
||||||
throw new Error(`Failed to install dotnet, exit code: ${exitCode}. ${stderr}`);
|
.useArguments(utils_1.IS_WINDOWS ? '-Channel' : '--channel', 'LTS')
|
||||||
|
.execute();
|
||||||
|
if (runtimeInstallOutput.exitCode) {
|
||||||
|
/**
|
||||||
|
* dotnetInstallScript will install CLI and runtime even if previous script haven't succeded,
|
||||||
|
* so at this point it's too early to throw an error
|
||||||
|
*/
|
||||||
|
core.warning(`Failed to install dotnet runtime + cli, exit code: ${runtimeInstallOutput.exitCode}. ${runtimeInstallOutput.stderr}`);
|
||||||
}
|
}
|
||||||
return this.parseInstalledVersion(stdout);
|
/**
|
||||||
|
* Install dotnet over the latest version of
|
||||||
|
* dotnet CLI
|
||||||
|
*/
|
||||||
|
const dotnetInstallOutput = yield new DotnetInstallScript()
|
||||||
|
// Don't overwrite CLI because it should be already installed
|
||||||
|
.useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files')
|
||||||
|
// Use version provided by user
|
||||||
|
.useVersion(dotnetVersion, this.quality)
|
||||||
|
.execute();
|
||||||
|
if (dotnetInstallOutput.exitCode) {
|
||||||
|
throw new Error(`Failed to install dotnet, exit code: ${dotnetInstallOutput.exitCode}. ${dotnetInstallOutput.stderr}`);
|
||||||
|
}
|
||||||
|
return this.parseInstalledVersion(dotnetInstallOutput.stdout);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
parseInstalledVersion(stdout) {
|
parseInstalledVersion(stdout) {
|
||||||
|
@ -259,21 +259,51 @@ export class DotnetCoreInstaller {
|
|||||||
const versionResolver = new DotnetVersionResolver(this.version);
|
const versionResolver = new DotnetVersionResolver(this.version);
|
||||||
const dotnetVersion = await versionResolver.createDotnetVersion();
|
const dotnetVersion = await versionResolver.createDotnetVersion();
|
||||||
|
|
||||||
const installScript = new DotnetInstallScript()
|
/**
|
||||||
|
* Install dotnet runitme first in order to get
|
||||||
|
* the latest stable version of dotnet CLI
|
||||||
|
*/
|
||||||
|
const runtimeInstallOutput = await new DotnetInstallScript()
|
||||||
|
// If dotnet CLI is already installed - avoid overwriting it
|
||||||
.useArguments(
|
.useArguments(
|
||||||
IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files'
|
IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files'
|
||||||
)
|
)
|
||||||
.useVersion(dotnetVersion, this.quality);
|
// Install only runtime + CLI
|
||||||
|
.useArguments(IS_WINDOWS ? '-Runtime' : '--runtime', 'dotnet')
|
||||||
|
// Use latest stable version
|
||||||
|
.useArguments(IS_WINDOWS ? '-Channel' : '--channel', 'LTS')
|
||||||
|
.execute();
|
||||||
|
|
||||||
const {exitCode, stderr, stdout} = await installScript.execute();
|
if (runtimeInstallOutput.exitCode) {
|
||||||
|
/**
|
||||||
if (exitCode) {
|
* dotnetInstallScript will install CLI and runtime even if previous script haven't succeded,
|
||||||
throw new Error(
|
* so at this point it's too early to throw an error
|
||||||
`Failed to install dotnet, exit code: ${exitCode}. ${stderr}`
|
*/
|
||||||
|
core.warning(
|
||||||
|
`Failed to install dotnet runtime + cli, exit code: ${runtimeInstallOutput.exitCode}. ${runtimeInstallOutput.stderr}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.parseInstalledVersion(stdout);
|
/**
|
||||||
|
* Install dotnet over the latest version of
|
||||||
|
* dotnet CLI
|
||||||
|
*/
|
||||||
|
const dotnetInstallOutput = await 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(dotnetVersion, this.quality)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
if (dotnetInstallOutput.exitCode) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to install dotnet, exit code: ${dotnetInstallOutput.exitCode}. ${dotnetInstallOutput.stderr}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.parseInstalledVersion(dotnetInstallOutput.stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
private parseInstalledVersion(stdout: string): string | null {
|
private parseInstalledVersion(stdout: string): string | null {
|
||||||
|
Loading…
Reference in New Issue
Block a user