From 1bd8c2f3481ae43297d68b6be209070a0a3217aa Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sat, 29 Mar 2025 11:48:50 +0000 Subject: [PATCH] Merge branch 'feature/auto-merge-production-to-dev' into 'dev' Add sync job to GitLab CI for branch synchronization See merge request rheinsw/website!2 --- .gitlab-ci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0af4a1d..3790266 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,6 +11,7 @@ stages: - build - docker - deploy + - sync cache: key: ${CI_COMMIT_REF_SLUG} @@ -94,3 +95,21 @@ deploy: only: - dev - production + +# ------------------ New sync job added below ------------------ + +sync_branches: + stage: sync + image: alpine/git:latest + rules: + - if: '$CI_COMMIT_BRANCH == "production"' + script: + - | + git config --global user.email "gitlab-ci@rheinsw.com" + git config --global user.name "RheinSW GitLab CI" + git remote set-url origin "https://oauth2:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git" + + git checkout dev + git pull origin dev + git merge --no-ff origin/production + git push origin dev