mirror of
https://github.com/actions/setup-dotnet.git
synced 2025-08-18 14:45:09 +00:00
Fixed review points
This commit is contained in:
parent
f2b31909b2
commit
18b0a81f30
6
.github/workflows/workflow.yml
vendored
6
.github/workflows/workflow.yml
vendored
@ -160,13 +160,9 @@ jobs:
|
|||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
dotnet-version: 2.2.X
|
dotnet-version: 2.2.X
|
||||||
- name: Setup dotnet 3.0.*
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
dotnet-version: 3.0.*
|
|
||||||
- name: Verify dotnet
|
- name: Verify dotnet
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: __tests__/verify-dotnet.ps1 '2.2' '3.0' '3.1'
|
run: __tests__/verify-dotnet.ps1 '2.2' '3.1'
|
||||||
|
|
||||||
test-setup-with-wildcard:
|
test-setup-with-wildcard:
|
||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
|
@ -8,7 +8,7 @@ inputs:
|
|||||||
dotnet-version:
|
dotnet-version:
|
||||||
description: 'Optional SDK version(s) to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x'
|
description: 'Optional SDK version(s) to use. If not provided, will install global.json version when available. Examples: 2.2.104, 3.1, 3.1.x'
|
||||||
dotnet-quality:
|
dotnet-quality:
|
||||||
description: 'Optional quality of the build. The possible values are: daily, signed, validated, preview, GA.'
|
description: 'Optional quality of the build. The possible values are: daily, signed, validated, preview, ga.'
|
||||||
global-json-file:
|
global-json-file:
|
||||||
description: 'Optional global.json location, if your global.json isn''t located in the root of the repo.'
|
description: 'Optional global.json location, if your global.json isn''t located in the root of the repo.'
|
||||||
source-url:
|
source-url:
|
||||||
|
18
dist/index.js
vendored
18
dist/index.js
vendored
@ -213,7 +213,7 @@ class DotnetVersionResolver {
|
|||||||
resolveVersionInput() {
|
resolveVersionInput() {
|
||||||
if (!semver_1.default.valid(this.inputVersion) &&
|
if (!semver_1.default.valid(this.inputVersion) &&
|
||||||
!semver_1.default.validRange(this.inputVersion)) {
|
!semver_1.default.validRange(this.inputVersion)) {
|
||||||
throw new Error(`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B.C-D, A.B.x, A.B.X, A.B.*`);
|
throw new Error(`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B, A.B.C, A.B.C-D, A.B.x, A.B.X, A.B.*`);
|
||||||
}
|
}
|
||||||
if (semver_1.default.valid(this.inputVersion)) {
|
if (semver_1.default.valid(this.inputVersion)) {
|
||||||
this.resolvedArgument.type = 'version';
|
this.resolvedArgument.type = 'version';
|
||||||
@ -222,12 +222,13 @@ class DotnetVersionResolver {
|
|||||||
else {
|
else {
|
||||||
this.resolvedArgument.type = 'channel';
|
this.resolvedArgument.type = 'channel';
|
||||||
this.resolvedArgument.qualityFlag = true;
|
this.resolvedArgument.qualityFlag = true;
|
||||||
this.resolvedArgument.value = semver_1.default.validRange(this.inputVersion)
|
if (semver_1.default.validRange(this.inputVersion)) {
|
||||||
? this.inputVersion
|
let coercedVersion = semver_1.default.coerce(this.inputVersion);
|
||||||
.split('.')
|
this.resolvedArgument.value = (coercedVersion === null || coercedVersion === void 0 ? void 0 : coercedVersion.major) + "." + (coercedVersion === null || coercedVersion === void 0 ? void 0 : coercedVersion.minor);
|
||||||
.slice(0, 2)
|
}
|
||||||
.join('.')
|
else {
|
||||||
: this.inputVersion;
|
this.resolvedArgument.value = this.inputVersion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createVersionObject() {
|
createVersionObject() {
|
||||||
@ -344,11 +345,12 @@ class DotnetCoreInstaller {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
|
core.addPath(DotnetCoreInstaller.installationDirectoryWindows);
|
||||||
core.exportVariable('DOTNET_ROOT', DotnetCoreInstaller.installationDirectoryWindows);
|
core.exportVariable('DOTNET_ROOT', DotnetCoreInstaller.installationDirectoryWindows);
|
||||||
}
|
}
|
||||||
else if (IS_LINUX) {
|
else if (IS_LINUX) {
|
||||||
core.exportVariable('DOTNET_ROOT', DotnetCoreInstaller.installationDirectoryLinux);
|
|
||||||
core.addPath(DotnetCoreInstaller.installationDirectoryLinux);
|
core.addPath(DotnetCoreInstaller.installationDirectoryLinux);
|
||||||
|
core.exportVariable('DOTNET_ROOT', DotnetCoreInstaller.installationDirectoryLinux);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// This is the default set in install-dotnet.sh
|
// This is the default set in install-dotnet.sh
|
||||||
|
@ -45,7 +45,7 @@ export class DotnetVersionResolver {
|
|||||||
!semver.validRange(this.inputVersion)
|
!semver.validRange(this.inputVersion)
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B.C-D, A.B.x, A.B.X, A.B.*`
|
`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B, A.B.C, A.B.C-D, A.B.x, A.B.X, A.B.*`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (semver.valid(this.inputVersion)) {
|
if (semver.valid(this.inputVersion)) {
|
||||||
@ -54,12 +54,12 @@ export class DotnetVersionResolver {
|
|||||||
} else {
|
} else {
|
||||||
this.resolvedArgument.type = 'channel';
|
this.resolvedArgument.type = 'channel';
|
||||||
this.resolvedArgument.qualityFlag = true;
|
this.resolvedArgument.qualityFlag = true;
|
||||||
this.resolvedArgument.value = semver.validRange(this.inputVersion)
|
if (semver.validRange(this.inputVersion)) {
|
||||||
? this.inputVersion
|
let coercedVersion = semver.coerce(this.inputVersion);
|
||||||
.split('.')
|
this.resolvedArgument.value = coercedVersion?.major + "." + coercedVersion?.minor;
|
||||||
.slice(0, 2)
|
} else {
|
||||||
.join('.')
|
this.resolvedArgument.value = this.inputVersion;
|
||||||
: this.inputVersion;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +83,8 @@ export class DotnetVersionResolver {
|
|||||||
export class DotnetCoreInstaller {
|
export class DotnetCoreInstaller {
|
||||||
private version: string;
|
private version: string;
|
||||||
private quality: string;
|
private quality: string;
|
||||||
static installationDirectoryWindows = path.join(process.env['PROGRAMFILES'] + '', "dotnet");
|
static readonly installationDirectoryWindows = path.join(process.env['PROGRAMFILES'] + '', "dotnet");
|
||||||
static installationDirectoryLinux = '/usr/share/dotnet';
|
static readonly installationDirectoryLinux = '/usr/share/dotnet';
|
||||||
|
|
||||||
constructor(version: string, quality: string) {
|
constructor(version: string, quality: string) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
@ -204,17 +204,18 @@ export class DotnetCoreInstaller {
|
|||||||
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
|
core.exportVariable('DOTNET_ROOT', process.env['DOTNET_INSTALL_DIR']);
|
||||||
} else {
|
} else {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
|
core.addPath(DotnetCoreInstaller.installationDirectoryWindows);
|
||||||
core.exportVariable(
|
core.exportVariable(
|
||||||
'DOTNET_ROOT',
|
'DOTNET_ROOT',
|
||||||
DotnetCoreInstaller.installationDirectoryWindows
|
DotnetCoreInstaller.installationDirectoryWindows
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else if (IS_LINUX) {
|
else if (IS_LINUX) {
|
||||||
|
core.addPath(DotnetCoreInstaller.installationDirectoryLinux);
|
||||||
core.exportVariable(
|
core.exportVariable(
|
||||||
'DOTNET_ROOT',
|
'DOTNET_ROOT',
|
||||||
DotnetCoreInstaller.installationDirectoryLinux
|
DotnetCoreInstaller.installationDirectoryLinux
|
||||||
);
|
);
|
||||||
core.addPath(DotnetCoreInstaller.installationDirectoryLinux);
|
|
||||||
} 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'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user