Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
git config --global user.email "azuredevops@microsoft.com"
git config --global user.name "Azure DevOps"
REPO="$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_git/$(Build.Repository.Name)"
EXTRAHEADER="Authorization: Bearer $(System.AccessToken)"
git -c http.extraheader="$EXTRAHEADER" clone $REPO
cd $(Build.Repository.Name)
MAINBRANCHNAME=$(git rev-parse --abbrev-ref HEAD)
git config http.$REPO.extraHeader "$EXTRAHEADER"
echo -- Merge $(Build.SourceBranchName) to $MAINBRANCHNAME --
git fetch origin $(Build.SourceBranchName) --prune
git merge origin/$(Build.SourceBranchName) -m "merge $(Build.SourceBranchName) to $MAINBRANCHNAME" --no-ff
TAGNAME=$(Release.ReleaseName)
echo -- Create tag named $TAGNAME --
git tag -a -m "$(Build.SourceBranchName) installed to production" $TAGNAME
git push origin $MAINBRANCHNAME
git push origin --tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment