Skip to content

Instantly share code, notes, and snippets.

@mishrsud
Created January 17, 2019 04:39
Show Gist options
  • Save mishrsud/f7610a46ee363b47fa6c7fabf341a123 to your computer and use it in GitHub Desktop.
Save mishrsud/f7610a46ee363b47fa6c7fabf341a123 to your computer and use it in GitHub Desktop.
Use gitversion as a docker container on a Linux build agent in Azure Devops (erstwhile VSTS)
# Docker container: gittools/gitversion-dotnetcore:linux-4.0.1
# NugetPackageVersion is a variable defined for the Azure DevOps pipeline
NEXTVERSION="$(docker run --rm -v "$(pwd):$BUILD_SOURCESDIRECTORY/path-to-repo" gittools/gitversion-dotnetcore:linux-4.0.1 $BUILD_SOURCESDIRECTORY/path-to-repo /output json /showvariable MajorMinorPatch)"
# the following command sets the pipeline variable's value to NEXTVERSION
echo "##vso[task.setvariable variable=NugetPackageVersion]$NEXTVERSION"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment