diff --git a/miv_gitlab-ci.yml b/miv_gitlab-ci.yml new file mode 100644 index 00000000..99946457 --- /dev/null +++ b/miv_gitlab-ci.yml @@ -0,0 +1,27 @@ +stages: + - mirror + +mirror-psi: + stage: mirror + script: + - SOURCE_REPOSITORY=https://$PSI_PROJECT_GIT_USRNAME:$PSI_PROJECT_GIT_TOKEN@gitlab.psi.ch/jungfraujoch/nextgendcu.git + - DESTINATION_REPOSITORY=https://$MIV_PROJECT_GIT_USRNAME:$MIV_PROJECT_GIT_TOKEN@gitlab.maxiv.lu.se/jungfraujoch/nextgendcu.git + - GIT_USER_NAME=git + - GIT_USER_EMAIL=git@maxiv.lu.se + - rm -rf _mirror_repo_tmp + - git clone --mirror $SOURCE_REPOSITORY _mirror_repo_tmp + - cd _mirror_repo_tmp + - git config --local user.name "${GIT_USER_NAME}" + - git config --local user.email "${GIT_USER_EMAIL}" + - git remote remove origin + - git remote add origin $DESTINATION_REPOSITORY + - git push --prune --all + - git push --prune --tags + after_script: + - rm -rf _mirror_repo_tmp + rules: + - if: '$CI_PIPELINE_SOURCE != "schedule" && $CI_PIPELINE_SOURCE != "trigger"' + when: never + - if: '$MODE != "sync"' + when: never + - when: always