Created
March 31, 2021 19:03
-
-
Save mirontoli/d06bc686aafe8a4642998b45dcd81a85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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