Using Nuke build to push a tag to an Azure Devops repository

488 Views Asked by At

I'm trying to figure out how to push a tag after a successful build back to the azure devops git repository. Whether I'm just asking the wrong questions or going about it wrong I'm just not sure, but I am at the point where I'd better reach out for help. I'm new to Azure Devops, not new to Git. I'm also new to nuke build - I used cake at my last job and really wanted to give nuke a try, but the company insisted on cake.

I see in the AzureDevops docs that I should be able to set "persistCredentials" and that should put the token into the credential manager for that session... but it seems like there ought to be something in the nuke components that would either set that or allow me to set it. I'm just not sure I'm looking in the right place.

Right now, I've built a target like the following:

Target Tag => _ => _
        .DependsOn(Pack)
        .Executes(() =>
        {
            Git($"config --global user.email \"[email protected]\"");
            Git($"config --global user.name \"Our Company Build\"");

            Git($"tag -a {GitVersion.FullSemVer} -m \"Setting git tag on commit to '{GitVersion.FullSemVer}'\"");
            Git($"push --set-upstream origin {GitRepository.Branch}");
        });

So I might be going about this completely wrong - if so, I'm up for correction or a point in the right direction. Thank you in advance!!!

1

There are 1 best solutions below

2
On

I think you have to specify the tag name you want to push. So your last line should rather be

Git($"push --set-upstream origin {GitVersion.FullSemVer}");