From dd1ea7cffb89a5f42dce49569b9e4140a250f0b7 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Wed, 22 Mar 2017 21:06:34 +0800 Subject: [PATCH] ci: Push release branches for wifi libraries to github --- .gitlab-ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 598980495..2e2eb2cea 100755 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,6 +5,7 @@ push_master_to_github: stage: deploy only: - master + - /^release\/v/ # when: on_success image: espressif/esp32-ci-env variables: @@ -18,4 +19,11 @@ push_master_to_github: - chmod 600 ~/.ssh/id_rsa - echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config - git remote add github git@github.com:espressif/esp32-wifi-lib.git - - git push github HEAD:master + # What the next line of script does: goes through the list of refs for all branches we push to github, + # generates a snippet of shell which is evaluated. The snippet checks CI_BUILD_REF against the SHA + # (aka objectname) at tip of each branch, and if any SHAs match then it checks out the local branch + # and then pushes that ref to a corresponding github branch + # + # NB: In gitlab 9.x, CI_BUILD_REF was deprecated. New name is CI_COMMIT_REF. If below command suddenly + # generates bash syntax errors, this is probably why. + - eval $(git for-each-ref --shell bash --format 'if [ $CI_BUILD_REF == %(objectname) ]; then git checkout -B %(refname:strip=3); git push --follow-tags github %(refname:strip=3); fi;' $GITHUB_PUSH_REFS)