@@ -8,34 +8,35 @@ using System.Text.RegularExpressions;
88public ( string versionPack , string versionRelease ) RunUpdateVersion ( string version , string packageFlow )
99{
1010 string versionMajor = "0.0" ;
11- string versionRevision = "0" ;
12- string prefixBranch = "" ;
11+ string numberPatchVersion = "0" ;
12+ // string prefixBranch = "";
13+ string prefixVersion = "" ;
1314
14- string branch = RunCommand ( "git" , "rev-parse --abbrev-ref HEAD" ) ;
15- var branch_part = branch . Split ( "/" ) ;
16-
17- var version_split = version . Split ( "." ) ;
18-
19- var regex = new Regex ( @"^\d+(\.\d+)*$" ) ;
20- if ( branch_part . Count ( ) > 0 && regex . IsMatch ( branch_part [ ^ 1 ] ) )
15+ var version_split = version . Split ( "/" ) ;
16+ if ( version_split . Count ( ) > 0 )
2117 {
22- prefixBranch = string . Join ( "" , branch_part [ ..^ 1 ] ) ;
18+ prefixVersion = string . Join ( "/" , version_split [ ..^ 1 ] ) ;
19+ var regex = new Regex ( @"^\d+(\.\d+)*$" ) ;
20+
21+ if ( regex . IsMatch ( version_split [ ^ 1 ] ) )
22+ {
23+ var version_split_split = version_split [ ^ 1 ] . Split ( "." ) ;
24+ if ( version_split_split . Count ( ) > 0 )
25+ {
26+ versionMajor = string . Join ( "." , version_split_split [ ..^ 1 ] ) ;
27+ numberPatchVersion = version_split_split [ ^ 1 ] ;
28+ }
29+ }
2330 }
2431 else
2532 {
26- prefixBranch = branch ;
27- }
28-
29- if ( version_split . Count ( ) > 0 )
30- {
31- versionMajor = string . Join ( "." , version_split [ ..^ 1 ] ) ;
32- versionRevision = version_split [ ^ 1 ] ;
33+ prefixVersion = version ;
3334 }
3435
35- string versionPatch = GenerateVersionPatch ( packageFlow , branch_part [ 0 ] ) ;
36+ string versionPatch = GenerateVersionPatch ( packageFlow , prefixVersion ) ;
3637
37- var versionPack = $ "{ versionMajor } { versionPatch } .{ versionRevision } ";
38- var versionRelease = $ "{ versionMajor } .{ versionRevision } ";
38+ var versionPack = $ "{ versionMajor } { versionPatch } .{ numberPatchVersion } ";
39+ var versionRelease = $ "{ prefixVersion } / { versionMajor } .{ numberPatchVersion } ";
3940
4041 return ( versionPack , versionRelease ) ;
4142}
0 commit comments