Skip to content

Commit

Permalink
docs(issue-180): add info of version numbers
Browse files Browse the repository at this point in the history
Merge pull request #189 from live-dev999/live-dev999/issue180
  • Loading branch information
live-dev999 committed Feb 8, 2022
2 parents d36dd60 + 68bb1b4 commit 8ce0269
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 1 deletion.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,4 +193,29 @@ AK name - 'AK_columnName_columnNameId'


## License
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FLiveDevTeam%2FO2NextGen.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FLiveDevTeam%2FO2NextGen?ref=badge_large)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FLiveDevTeam%2FO2NextGen.svg?type=large)](https://app.fossa.com/projects/git%2Bgithub.com%2FLiveDevTeam%2FO2NextGen?ref=badge_large)


# Versions

#### Version information for an assembly consists of the following four values:

```
1.0.0.0
```

Description
```
major - Major Version
minor - Minor Version
build number - Build Number
0 - alpha
sample: 1.1.0.1 like (1.1-a.1)
1 - beta
sample: 1.1.1.2 like (1.1-b.2)
2 - release candidate
sample: 1.1.2.1 like (1.1-rc.1)
3 - release
sample: 1.1.3.3 like (1.1-r.3)
revision - git revision
```
46 changes: 46 additions & 0 deletions update-version.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
param ($branch )
write-host $system_build_counter

# $branch = git rev-parse --abbrev-ref HEAD
Write-Host "##branch is: $branch"
$versionTag = $(git describe --match "*.*" --abbrev=0)
Write-Host "##versionTag is: $versionTag"
$distanceFromTag = $(git rev-list "$versionTag..HEAD" --count)
Write-Host "##distanceFromTag is: $distanceFromTag"

$splitted = $versionTag.Split(".")
$revision = [int]$distanceFromTag;

# Sometimes the branch will be a full path, e.g., 'refs/heads/master'.
# If so we'll base our logic just on the last part.
if ($branch.Contains("/")) {
$branch = $branch.substring($branch.lastIndexOf("/")).trim("/")
}

if ($splitted.Length -eq 4) {
$revision += [int]$splitted[3]
}
if ($branch -eq "master") {
$versionInfo = -join ($splitted[0], ".", $splitted[1], ".", $splitted[2], ".", $revision)
}
elseif ($branch -eq "develop") {
$versionInfo = -join ($splitted[0], ".", $splitted[1], ".", $splitted[2], "-", "dev", ".", $revision)
}

elseif ($branch -match "release-.*") {
$versionInfo = -join ($splitted[0], ".", $splitted[1], ".", $splitted[2], ".", $revision)
}
else {
# If the branch starts with "feature-", just use the feature name
$branch = $branch.replace("feature-", "")
$versionInfo = -join ($splitted[0], ".", $splitted[1], ".", $splitted[2], "-", $branch, ".", $revision)
}
$version = -join ($splitted[0], ".", $splitted[1], ".", $splitted[2], ".", $revision)
Write-Host "##Version is: $version"
Write-Host "##VersionInfo is: $versionInfo"

$dockerTag = -join ($branch, "-", $splitted[0], ".", $splitted[1], ".", $splitted[2], ".", $revision)
Write-Host "##Docker tag is: $dockerTag"

$versionInfo | Out-File ./version.txt
$dockerTag | Out-File ./tag.txt

0 comments on commit 8ce0269

Please sign in to comment.