diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..a642a2c --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,39 @@ +image: docker:20.10@sha256:2967f0819c84dd589ed0a023b9d25dcfe7a3c123d5bf784ffbb77edf55335f0c + +include: + - local: 'backend/.gitlab-ci-backend.yml' + - local: 'frontend/.gitlab-ci-frontend.yml' + +stages: + - sync + - deploy + - backend_build + - frontend_build + +sync_branches: + stage: sync + 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 + +deploy_dev: + stage: deploy + rules: + - if: '$CI_COMMIT_BRANCH == "dev"' + script: + - echo "Deploying DEV environment" + +deploy_production: + stage: deploy + rules: + - if: '$CI_COMMIT_BRANCH == "production"' + script: + - echo "Deploying PROD environment" diff --git a/backend/.gitlab-ci-backend.yml b/backend/.gitlab-ci-backend.yml new file mode 100644 index 0000000..36bcc18 --- /dev/null +++ b/backend/.gitlab-ci-backend.yml @@ -0,0 +1,7 @@ +stages: + - backend_build + +backend_build_job: + stage: backend_build + script: + - echo "Building backend project on branch: $CI_COMMIT_BRANCH" diff --git a/frontend/.gitlab-ci-frontend.yml b/frontend/.gitlab-ci-frontend.yml new file mode 100644 index 0000000..1cc5590 --- /dev/null +++ b/frontend/.gitlab-ci-frontend.yml @@ -0,0 +1,7 @@ +stages: + - frontend_build + +frontend_build_job: + stage: frontend_build + script: + - echo "Building frontend project on branch: $CI_COMMIT_BRANCH"