Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Tasks/DotNetCoreCLIV2/packcommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,22 @@ export async function run(): Promise<void> {

version = versionMatches[0];
break;

case "bySemVerBuildNumber":
tl.debug("Getting version number using SemVer build number");

let semVerBuildNumber: string = tl.getVariable("BUILD_BUILDNUMBER");
tl.debug(`Build number: ${semVerBuildNumber}`);

// Validate full SemVer 2.0 format
let semVerRegex = /^\d+\.\d+\.\d+(?:\.\d+)?(?:[-\w\.]+)?(?:\+[0-9A-Za-z\-\.]+)?$/;
if (!semVerRegex.test(semVerBuildNumber)) {
tl.setResult(tl.TaskResult.Failed, tl.loc("Error_InvalidSemVer"));
return;
}
version = semVerBuildNumber;
break;

}

tl.debug(`Version to use: ${version}`);
Expand Down
8 changes: 5 additions & 3 deletions Tasks/DotNetCoreCLIV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 2,
"Minor": 266,
"Patch": 0
"Patch": 1
},
"minimumAgentVersion": "2.144.0",
"instanceNameFormat": "dotnet $(command)",
Expand Down Expand Up @@ -419,7 +419,8 @@
"off": "Off",
"byPrereleaseNumber": "Use the date and time",
"byEnvVar": "Use an environment variable",
"byBuildNumber": "Use the build number"
"byBuildNumber": "Use the build number",
"bySemVerBuildNumber": "Use full SemVer build number"
}
},
{
Expand Down Expand Up @@ -602,6 +603,7 @@
"DeprecatedDotnet2_2_And_3_0": "Info: .NET Core SDK/runtime 2.2 and 3.0 are now End of Life(EOL) and have been removed from all hosted agents. If you're using these SDK/runtimes on hosted agents, kindly upgrade to newer versions which are not EOL, or else use UseDotNet task to install the required version.",
"Warning_IncludeNuGetOrgEnabled": "IncludeNugetOrg is currently enabled for this task. To resolve this warning, edit your build task and set 'includeNuGetOrg' to 'false' or deselect 'Use packages from NuGet.org'.",
"Error_IncludeNuGetOrgEnabled": "Packages failed to restore. Edit your build task and set 'includeNuGetOrg' to 'false' or deselect 'Use packages from NuGet.org'.",
"Warning_UnsupportedServiceConnectionAuth": "The service connection does not use a supported authentication method. Please use a service connection with personal access token based auth."
"Warning_UnsupportedServiceConnectionAuth": "The service connection does not use a supported authentication method. Please use a service connection with personal access token based auth.",
"Error_InvalidSemVer": "Build number is not a valid SemVer 2.0 string."
}
}
5 changes: 3 additions & 2 deletions Tasks/DotNetCoreCLIV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"version": {
"Major": 2,
"Minor": 266,
"Patch": 0
"Patch": 1
},
"minimumAgentVersion": "2.144.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down Expand Up @@ -419,7 +419,8 @@
"off": "Off",
"byPrereleaseNumber": "Use the date and time",
"byEnvVar": "Use an environment variable",
"byBuildNumber": "Use the build number"
"byBuildNumber": "Use the build number",
"bySemVerBuildNumber": "Use full SemVer build number"
}
},
{
Expand Down
Loading