From d9263f5eaa6a5192552bcd553be34442fd7a0b38 Mon Sep 17 00:00:00 2001 From: Thatsaphorn Atchariyaphap Date: Sun, 21 Sep 2025 00:52:38 +0200 Subject: [PATCH] Add `sync_dev_branch` job to GitLab CI for syncing production changes into dev --- .gitlab-ci.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2585751..fd98948 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,7 @@ stages: - prepare - test - build + - sync variables: CI_REGISTRY_IMAGE: $CI_REGISTRY/$CI_PROJECT_PATH @@ -11,4 +12,19 @@ variables: include: - local: 'backend/.gitlab-ci.yml' - - local: 'finlog_app/.gitlab-ci.yml' \ No newline at end of file + - local: 'finlog_app/.gitlab-ci.yml' + +sync_dev_branch: + stage: sync + image: node:22@sha256:f6b9c31ace05502dd98ef777aaa20464362435dcc5e312b0e213121dcf7d8b95 + rules: + - if: '$CI_COMMIT_BRANCH == "production"' + before_script: + - git config --global user.email "gitlab-ci@rhein-software.dev" + - git config --global user.name "GitLab CI" + script: + - 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