From ac5026973e3af23923ae9f77064ec2c6707c8966 Mon Sep 17 00:00:00 2001 From: Denis Prokhorchik Date: Tue, 8 Feb 2022 05:31:06 +0300 Subject: [PATCH 1/2] docs(issue-180): update readme.md --- README.md | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f74eb18..f87d97b2 100644 --- a/README.md +++ b/README.md @@ -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) \ No newline at end of file +[![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 + ``` \ No newline at end of file From 68bb1b414c50860a70468fae826d150b8ee103e3 Mon Sep 17 00:00:00 2001 From: Denis Prokhorchik Date: Tue, 8 Feb 2022 05:44:47 +0300 Subject: [PATCH 2/2] docs(issue-180): add script ps1 --- update-version.ps1 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 update-version.ps1 diff --git a/update-version.ps1 b/update-version.ps1 new file mode 100644 index 00000000..c2a67513 --- /dev/null +++ b/update-version.ps1 @@ -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 \ No newline at end of file