File tree Expand file tree Collapse file tree 4 files changed +63
-18
lines changed
Expand file tree Collapse file tree 4 files changed +63
-18
lines changed Original file line number Diff line number Diff line change 55 package-flow :
66 description : " Generate the package flow version."
77 required : false
8+ version :
9+ description : " Version of packet."
10+ required : false
811outputs :
912 version-pack :
1013 description : " Version pack"
@@ -19,12 +22,24 @@ runs:
1922 shell : bash
2023 run : dotnet tool install -g dotnet-script
2124
22- - name : Ejecutar script C#
25+ - name : New version
26+ if : inputs.version == ''
27+ id : run
28+ shell : bash
29+ run : |
30+ output=$(~/.dotnet/tools/dotnet-script $GITHUB_ACTION_PATH/src/RunNewVersion.csx ${{ inputs.package-flow }})
31+
32+ - name : Update version
33+ if : inputs.version != ''
2334 id : run
2435 shell : bash
2536 run : |
26- output=$(~/.dotnet/tools/dotnet-script $GITHUB_ACTION_PATH/src/Run.csx ${{ inputs.package-flow }})
27-
37+ output=$(~/.dotnet/tools/dotnet-script $GITHUB_ACTION_PATH/src/RunUpdateVersion.csx pf=${{ inputs.package-flow } v=${{ inputs.version }})
38+
39+ - name : Read version
40+ id : run
41+ shell : bash
42+ run : |
2843 version_pack=$(echo "$output" | tail -n 3 | sed -n '1p')
2944 version_release=$(echo "$output" | tail -n 3 | sed -n '2p')
3045
Original file line number Diff line number Diff line change @@ -8,19 +8,16 @@ enum Patch
88 Release
99}
1010
11- string GenerateVersionPatch ( IList < string > args , string patchType )
11+ string GenerateVersionPatch ( string patchBranch , string patchType )
1212{
1313 string versionPatch ;
1414 Patch patch = Patch . None ;
1515
16- if ( args . Count ( ) > 0 )
17- {
18- var arg = args [ 0 ] . ToUpper ( ) ;
19- if ( arg . Contains ( "CANDIDATE" ) || arg . Contains ( "RC" ) )
20- patch = Patch . ReleaseCandidate ;
21- else if ( arg . Contains ( "PRE" ) )
22- patch = Patch . Preview ;
23- }
16+ patchBranch = patchBranch . ToUpper ( ) ;
17+ if ( patchBranch . Contains ( "CANDIDATE" ) || patchBranch . Contains ( "RC" ) )
18+ patch = Patch . ReleaseCandidate ;
19+ else if ( patchBranch . Contains ( "PRE" ) )
20+ patch = Patch . Preview ;
2421
2522 if ( patchType == "develop" )
2623 versionPatch = $ "-alpha";
Original file line number Diff line number Diff line change 11#load "RunCommand.csx"
2- #load "GenerateVersion .csx"
2+ #load "GenerateVersionPatch .csx"
33#load "GetLastVersion.csx"
44#load "GenerateTag.csx"
55using System ;
66
7+ string packageFlow = "" ;
8+ if ( Args . Count ( ) > 0 )
9+ packageFlow = Args [ 0 ] ;
10+
711string versionMajor = "0.0" ;
812
913string branch = RunCommand ( "git" , "rev-parse --abbrev-ref HEAD" ) ;
@@ -12,15 +16,13 @@ var branch_part = branch.Split("/");
1216if ( branch_part . Count ( ) > 1 )
1317 versionMajor = branch_part [ branch_part . Count ( ) - 1 ] ;
1418
15- // string numberComints = RunCommand("git", "rev-list --count HEAD");
16-
1719var numberPatchVersion = GetLastVersion ( branch ) ;
1820
19- string versionPatch = GenerateVersionPatch ( Args , branch_part [ 0 ] ) ;
21+ string versionPatch = GenerateVersionPatch ( packageFlow , branch_part [ 0 ] ) ;
2022
2123string version = $ "{ versionMajor } { versionPatch } ";
2224
23- GenerateTag ( $ "{ branch } .{ numberPatchVersion } ") ;
25+ GenerateTag ( $ "{ versionMajor } .{ numberPatchVersion } ") ;
2426
2527Console . WriteLine ( $ "{ versionMajor } { versionPatch } .{ numberPatchVersion } ") ;
26- Console . WriteLine ( $ "{ versionMajor } .{ numberPatchVersion } ") ;
28+ Console . WriteLine ( $ "{ versionMajor } .{ numberPatchVersion } ") ;
Original file line number Diff line number Diff line change 1+ #load "RunCommand.csx"
2+ #load "GenerateVersionPatch.csx"
3+ #load "GetLastVersion.csx"
4+ #load "GenerateTag.csx"
5+ using System ;
6+
7+ string packageFlow = "" ;
8+ var version = "" ;
9+
10+ // var args = Args.Split(" ");
11+ foreach ( var arg in Args )
12+ {
13+ var parts = arg . Split ( "=" ) ;
14+ if ( parts [ 0 ] == "pf" )
15+ packageFlow = parts [ 1 ] ;
16+ else if ( parts [ 0 ] == "v" )
17+ version = parts [ 1 ] ;
18+ }
19+
20+ var versionPart = version . Split ( "/" ) ;
21+ var versionPartPart = versionPart [ ^ 1 ] . Split ( "." ) ;
22+
23+ string versionMajor = string . Join ( "." , versionPartPart [ ..^ 1 ] ) ;
24+ string numberPatchVersion = versionPartPart [ ^ 1 ] ;
25+
26+ string versionPatch = GenerateVersionPatch ( packageFlow , versionPart [ 0 ] ) ;
27+
28+ version = $ "{ versionMajor } { versionPatch } ";
29+
30+ Console . WriteLine ( $ "{ versionMajor } { versionPatch } .{ numberPatchVersion } ") ;
31+ Console . WriteLine ( $ "{ versionMajor } .{ numberPatchVersion } ") ;
You can’t perform that action at this time.
0 commit comments