Skip to content

Commit ff3d020

Browse files
committed
Push on bump.
1 parent b098526 commit ff3d020

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/PostSharp.Engineering.BuildTools/Build/Bumping/BumpCommand.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,15 @@ public static bool Execute( BuildContext context, BumpSettings settings )
174174
return false;
175175
}
176176

177+
// If we are running in TeamCity, push.
178+
if ( context.IsContinuousIntegrationBuild )
179+
{
180+
if ( !GitHelper.TryPush( context ) )
181+
{
182+
return false;
183+
}
184+
}
185+
177186
return true;
178187
}
179188

src/PostSharp.Engineering.BuildTools/Tools/Git/DownstreamMerge.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public static bool MergeDownstream( BuildContext context, DownstreamMergeSetting
306306
// Push the branch now to avoid issues when the DownstreamMergeCommand
307307
// is executed again with the same upstream changes
308308
// or when developers are required to resolve conflicts.
309-
if ( !GitHelper.TryPush( context, settings ) )
309+
if ( !GitHelper.TryPush( context ) )
310310
{
311311
return false;
312312
}
@@ -428,7 +428,7 @@ void AddFileToKeepOwn( string path )
428428
}
429429

430430
// We push even if there's nothing to merge as there could be commits from manual conflict resolution.
431-
if ( !GitHelper.TryPush( context, settings ) )
431+
if ( !GitHelper.TryPush( context ) )
432432
{
433433
areChangesPending = false;
434434

src/PostSharp.Engineering.BuildTools/Utilities/GitHelper.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public static bool TryPullAndMergeAndPush( BuildContext context, BuildSettings s
105105
}
106106

107107
// Push the target branch.
108-
if ( !TryPush( context, settings ) )
108+
if ( !TryPush( context ) )
109109
{
110110
return false;
111111
}
@@ -292,7 +292,7 @@ public static bool TryGetRemoteReferences(
292292
{
293293
references = null;
294294

295-
if ( !TryGetOriginUrl( context, settings, out var originUrl ) )
295+
if ( !TryGetOriginUrl( context, out var originUrl ) )
296296
{
297297
return false;
298298
}
@@ -432,7 +432,7 @@ public static bool TryResolveUsingOurs( BuildContext context, string file )
432432
return true;
433433
}
434434

435-
private static bool TryGetOriginUrl( BuildContext context, BaseBuildSettings settings, [NotNullWhen( true )] out string? url )
435+
private static bool TryGetOriginUrl( BuildContext context, [NotNullWhen( true )] out string? url )
436436
{
437437
url = null;
438438

@@ -456,7 +456,7 @@ private static bool TryGetOriginUrl( BuildContext context, BaseBuildSettings set
456456
var isHttps = url.StartsWith( "https", StringComparison.InvariantCulture );
457457

458458
// When on TeamCity, origin will be updated to form including Git authentication credentials.
459-
if ( isHttps && TeamCityHelper.IsTeamCityBuild( settings ) )
459+
if ( isHttps && context.IsContinuousIntegrationBuild )
460460
{
461461
if ( !TeamCityHelper.TryGetTeamCitySourceWriteToken(
462462
out var teamcitySourceWriteTokenEnvironmentVariableName,
@@ -474,9 +474,9 @@ private static bool TryGetOriginUrl( BuildContext context, BaseBuildSettings set
474474
return true;
475475
}
476476

477-
public static bool TryPush( BuildContext context, BaseBuildSettings settings )
477+
public static bool TryPush( BuildContext context )
478478
{
479-
if ( !TryGetOriginUrl( context, settings, out var originUrl ) )
479+
if ( !TryGetOriginUrl( context, out var originUrl ) )
480480
{
481481
return false;
482482
}
@@ -627,7 +627,7 @@ public static bool ConfigureAuthentication( BuildContext context )
627627
{
628628
var console = context.Console;
629629
var environmentVariable = context.Product.DependencyDefinition.VcsRepository.TokenEnvironmentVariableName;
630-
630+
631631
console.WriteMessage( "Configuring git credentials." );
632632

633633
if ( RuntimeInformation.IsOSPlatform( OSPlatform.Windows ) )

0 commit comments

Comments
 (0)