Rebuild action

This commit is contained in:
IvanZosimov 2023-04-10 16:24:56 +02:00
parent 4f6b2f576a
commit 660c25a321
2 changed files with 30 additions and 22 deletions

36
dist/index.js vendored
View File

@ -250,27 +250,35 @@ class DotnetVersionResolver {
} }
resolveVersionInput() { resolveVersionInput() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
if (!semver_1.default.validRange(this.inputVersion)) { const isLatestPatchSyntax = /^\d+\.\d+\.\d{1}x{2}$/.test(this.inputVersion);
throw new Error(`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x`); if (!semver_1.default.validRange(this.inputVersion) && !isLatestPatchSyntax) {
throw new Error(`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x, A.B.Cxx`);
} }
if (semver_1.default.valid(this.inputVersion)) { if (semver_1.default.valid(this.inputVersion)) {
this.resolvedArgument.type = 'version'; this.resolvedArgument.type = 'version';
this.resolvedArgument.value = this.inputVersion; this.resolvedArgument.value = this.inputVersion;
} }
else if (!this.inputVersion) {
this.resolvedArgument.type = null;
}
else { else {
this.resolvedArgument.type = 'channel';
const [major, minor] = this.inputVersion.split('.'); const [major, minor] = this.inputVersion.split('.');
if (this.isNumericTag(major)) { if (isLatestPatchSyntax) {
this.resolvedArgument.type = 'channel'; this.resolvedArgument.value = this.inputVersion;
if (this.isNumericTag(minor)) { }
this.resolvedArgument.value = `${major}.${minor}`; else if (this.isNumericTag(major) && this.isNumericTag(minor)) {
} this.resolvedArgument.value = `${major}.${minor}`;
else { }
const httpClient = new hc.HttpClient('actions/setup-dotnet', [], { else {
allowRetries: true, const httpClient = new hc.HttpClient('actions/setup-dotnet', [], {
maxRetries: 3 allowRetries: true,
}); maxRetries: 3
this.resolvedArgument.value = yield this.getLatestVersion(httpClient, [major, minor]); });
} this.resolvedArgument.value = yield this.getLatestVersion(httpClient, [
major,
minor
]);
} }
this.resolvedArgument.qualityFlag = +major >= 6 ? true : false; this.resolvedArgument.qualityFlag = +major >= 6 ? true : false;
} }

View File

@ -46,14 +46,14 @@ export class DotnetVersionResolver {
} else if (this.isNumericTag(major) && this.isNumericTag(minor)) { } else if (this.isNumericTag(major) && this.isNumericTag(minor)) {
this.resolvedArgument.value = `${major}.${minor}`; this.resolvedArgument.value = `${major}.${minor}`;
} else { } else {
const httpClient = new hc.HttpClient('actions/setup-dotnet', [], { const httpClient = new hc.HttpClient('actions/setup-dotnet', [], {
allowRetries: true, allowRetries: true,
maxRetries: 3 maxRetries: 3
}); });
this.resolvedArgument.value = await this.getLatestVersion( this.resolvedArgument.value = await this.getLatestVersion(httpClient, [
httpClient, major,
[major, minor] minor
); ]);
} }
this.resolvedArgument.qualityFlag = +major >= 6 ? true : false; this.resolvedArgument.qualityFlag = +major >= 6 ? true : false;
} }