From b1a29f33cdc39282f81beb2e9719464287ffcd7d Mon Sep 17 00:00:00 2001 From: julenalbi <julenalbizuri3@gmail.com> Date: Fri, 18 Mar 2022 10:02:41 +0100 Subject: [PATCH] use proper principal branch --- stack-updater/get_principal_branch.sh | 6 ++++++ stack-updater/stack_updater.yml | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 stack-updater/get_principal_branch.sh diff --git a/stack-updater/get_principal_branch.sh b/stack-updater/get_principal_branch.sh new file mode 100644 index 0000000..f37d1ca --- /dev/null +++ b/stack-updater/get_principal_branch.sh @@ -0,0 +1,6 @@ +if git branch -a | grep -q main +then + echo "main"; +else + echo "master"; +fi diff --git a/stack-updater/stack_updater.yml b/stack-updater/stack_updater.yml index b8930ee..4c4fa00 100644 --- a/stack-updater/stack_updater.yml +++ b/stack-updater/stack_updater.yml @@ -18,12 +18,14 @@ update: - git add package.json - git commit -m "Dependencies updated to $current_version" - npm version --allow-same-version $current_version - - git checkout master # XXX Change this + - branch=`bash get_principal_branch.sh` + - echo ${branch} + - git checkout ${branch} - git pull - - git branch --set-upstream-to=origin/master master + - git branch --set-upstream-to=origin/${branch} ${branch} - git merge $current_version - git remote rm origin && git remote add origin "https://${access_token_name}:${access_token}@git.code.tecnalia.com/${CI_PROJECT_PATH}.git" - - git push --follow-tags --set-upstream origin master + - git push --follow-tags --set-upstream origin ${branch} - node package-version-updater/updateGitlabSide.js --cV $current_version --nV $next_version -p $CI_PROJECT_ID -t $access_token only: - api -- GitLab