For a nightly build it makes no sense to publish a NuGet package as no code changed and therefore the same GitVersion is calculated.

Since version 2017 Update 3 the on premise version of Microsoft’s Team Foundation Server supports “Custom Conditions” on “Build Tasks” – but sadly not on “Task Groups”.

Here is what you need to exclude a step from a scheduled build:

and(
  succeeded(),
  ne(
    variables['Build.RequestedFor'],
    'Microsoft.TeamFoundation.System'
  )
)

Here a screenshot of the condition in action:

image

HTH