1
- using GitVersion . Logging ;
1
+ using GitVersion . Logging ;
2
2
using GitVersion . OutputVariables ;
3
3
4
4
namespace GitVersion . BuildAgents ;
@@ -24,24 +24,19 @@ public override string[] GenerateSetParameterMessage(string name, string value)
24
24
$ "GITVERSION_{ name . ToUpperInvariant ( ) } ={ value } "
25
25
} ;
26
26
27
- public override string ? GetCurrentBranch ( bool usingDynamicRepos )
28
- {
29
- var branchName = EvaluateEnvironmentVariable ( BranchEnvironmentVariableName ) ;
30
- if ( branchName != null && branchName . StartsWith ( "refs/heads/" ) )
31
- {
32
- return branchName ;
33
- }
34
-
35
- return null ;
36
- }
37
-
38
27
public override void WriteIntegration ( Action < string ? > writer , VersionVariables variables , bool updateBuildNumber = true )
39
28
{
40
29
if ( this . file is null )
41
30
return ;
42
31
43
32
base . WriteIntegration ( writer , variables , updateBuildNumber ) ;
44
33
writer ( $ "Outputting variables to '{ this . file } ' ... ") ;
34
+ writer ( "To import the file into your build environment, add the following line to your build step:" ) ;
35
+ writer ( $ " - source { this . file } ") ;
36
+ writer ( "" ) ;
37
+ writer ( "To reuse the file across build steps, add the file as a build artifact:" ) ;
38
+ writer ( " artifacts:" ) ;
39
+ writer ( $ " - { this . file } ") ;
45
40
46
41
var exports = variables
47
42
. Select ( variable => $ "export GITVERSION_{ variable . Key . ToUpperInvariant ( ) } ={ variable . Value } ")
@@ -50,6 +45,16 @@ public override void WriteIntegration(Action<string?> writer, VersionVariables v
50
45
File . WriteAllLines ( this . file , exports ) ;
51
46
}
52
47
48
+ public override string ? GetCurrentBranch ( bool usingDynamicRepos )
49
+ {
50
+ var branchName = EvaluateEnvironmentVariable ( BranchEnvironmentVariableName ) ;
51
+ if ( branchName != null && branchName . StartsWith ( "refs/heads/" ) )
52
+ {
53
+ return branchName ;
54
+ }
55
+
56
+ return null ;
57
+ }
53
58
54
59
private string ? EvaluateEnvironmentVariable ( string variableName )
55
60
{
0 commit comments