Skip to content

Instantly share code, notes, and snippets.

@kunalworldwide
Last active December 26, 2022 16:45
Show Gist options
  • Save kunalworldwide/4c687e7c551502ba38fbd1b6b3e39090 to your computer and use it in GitHub Desktop.
Save kunalworldwide/4c687e7c551502ba38fbd1b6b3e39090 to your computer and use it in GitHub Desktop.
steps:
- bash: |
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)
mkdir 'QA-env'
cd 'QA-env'
cp '$(System.DefaultWorkingDirectory)/ARM/TemplateForWorkspace.json' .
cp '$(System.DefaultWorkingDirectory)/ARM/TemplateParametersForWorkspace.json' .
cd ..
git add Template-QA/TemplateForWorkspace.json
git add Template-QA/TemplateParametersForWorkspace.json
MAINBRANCHNAME=main
git config http.$REPO.extraHeader "$EXTRAHEADER"
git commit -a -m "added QA json updated files"
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 --allow-unrelated-histories
git push origin $MAINBRANCHNAME
git push origin --tags
displayName: 'Bash Script'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment