From 8d792f8e6f07821125763e6a3f4916bb85c7125d Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen.haas@lakedrops.com>
Date: Thu, 29 Jun 2023 15:40:31 +0200
Subject: [PATCH] gitlab-ci-cd/drupal#57 New task to merge release branch into
 main which only runs on scheduled pipelines in the release branch

---
 lakedrops.yml       |  3 +++
 test-and-deploy.yml | 24 ++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/lakedrops.yml b/lakedrops.yml
index e48db45..ec1a680 100644
--- a/lakedrops.yml
+++ b/lakedrops.yml
@@ -63,6 +63,9 @@ Check 4 Updates:
 Release:
   extends: '.createrelease'
 
+Publish Release:
+  extends: '.deployrelease'
+
 LakeDrops:
   stage: execute
   variables:
diff --git a/test-and-deploy.yml b/test-and-deploy.yml
index 90b95ff..085a7b0 100644
--- a/test-and-deploy.yml
+++ b/test-and-deploy.yml
@@ -668,6 +668,30 @@ Debug:
       - $CHECKUPDATES
       - $TRIGGERTASK
 
+.deployrelease:
+  stage: release
+  tags:
+    - default
+  variables:
+    GIT_STRATEGY: none
+  image: registry.lakedrops.com/docker/gitlab-drupal-ci/php-${PHP_MAJOR_VERSION}.${PHP_MINOR_VERSION}
+  cache: {}
+  before_script: !reference [.prepareaccess, before_script]
+  script:
+    - rm -rf /tmp/release || true
+    - mkdir -p /tmp/release
+    - cd /tmp/release
+    - git clone -b release git@${CI_SERVER_HOST}:$CI_PROJECT_PATH.git .
+    - merge
+    - cd -
+    - rm -rf /tmp/release || true
+  dependencies:
+    - 'Validate Environment'
+  rules:
+    - if: $CI_COMMIT_REF_NAME != "release"
+      when: never
+    - if: $CI_PIPELINE_SOURCE == "schedule"
+
 .check4update:
   stage: validation
   tags:
-- 
GitLab