Skip to content

Commit

Permalink
Sync eng/common directory with azure-sdk-tools repository (#10531)
Browse files Browse the repository at this point in the history
  • Loading branch information
azure-sdk authored Mar 26, 2020
1 parent cf1c244 commit 59e7d42
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions eng/common/scripts/copy-docs-to-blobstorage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,26 @@ param (
$Language = $Language.ToLower()

# Regex inspired but simplified from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
$SEMVER_REGEX = "^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-?(?<prelabel>[a-zA-Z-]*)(?:\.?(?<prenumber>0|[1-9]\d*)))?$"
$SEMVER_REGEX = "^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-?(?<prelabel>[a-zA-Z-]*)(?:\.?(?<prenumber>0|[1-9]\d*))?)?$"

function ToSemVer($version){
if ($version -match $SEMVER_REGEX)
{
if($matches['prelabel'] -eq $null) {
if(-not $matches['prelabel']) {
# artifically provide these values for non-prereleases to enable easy sorting of them later than prereleases.
$prelabel = "zzz"
$prenumber = 999;
$isPre = $false;
}
else {
$prelabel = $matches["prelabel"]
$prenumber = [int]$matches["prenumber"]
$prenumber = 0

# some older packages don't have a prenumber, should handle this
if($matches["prenumber"]){
$prenumber = [int]$matches["prenumber"]
}

$isPre = $true;
}

Expand Down

0 comments on commit 59e7d42

Please sign in to comment.