Skip to content

Commit 96a3546

Browse files
committed
Added some extra messaging to the build output to help get things set up straight
1 parent e15413f commit 96a3546

File tree

1 file changed

+17
-12
lines changed

1 file changed

+17
-12
lines changed

src/GitVersion.Core/BuildAgents/BitBucketPipelines.cs

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using GitVersion.Logging;
1+
using GitVersion.Logging;
22
using GitVersion.OutputVariables;
33

44
namespace GitVersion.BuildAgents;
@@ -24,24 +24,19 @@ public override string[] GenerateSetParameterMessage(string name, string value)
2424
$"GITVERSION_{name.ToUpperInvariant()}={value}"
2525
};
2626

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-
3827
public override void WriteIntegration(Action<string?> writer, VersionVariables variables, bool updateBuildNumber = true)
3928
{
4029
if (this.file is null)
4130
return;
4231

4332
base.WriteIntegration(writer, variables, updateBuildNumber);
4433
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}");
4540

4641
var exports = variables
4742
.Select(variable => $"export GITVERSION_{variable.Key.ToUpperInvariant()}={variable.Value}")
@@ -50,6 +45,16 @@ public override void WriteIntegration(Action<string?> writer, VersionVariables v
5045
File.WriteAllLines(this.file, exports);
5146
}
5247

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+
}
5358

5459
private string? EvaluateEnvironmentVariable(string variableName)
5560
{

0 commit comments

Comments
 (0)