From e2ae46b336738aff2570af285626f624f632afa2 Mon Sep 17 00:00:00 2001
From: Anne Matthes <Anne.Matthes@open-xchange.com>
Date: Fri, 16 Apr 2021 14:15:31 +0200
Subject: [PATCH] Add upload stage

---
 .gitlab-ci.yml | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6c1c72e..ede05ad 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -12,6 +12,32 @@ build:
   tags:
     - kubernetes
 
+upload Helm Chart:
+  stage: build
+  image: alpine/helm:3.5.3
+  rules:
+    - if: $CI_MERGE_REQUEST_ID
+      when: never
+    - if: '$CI_COMMIT_BRANCH == "main"'
+      when: on_success
+      variables:
+        TAG_NAME: stable
+    - if: '$CI_COMMIT_BRANCH == "develop"'
+      when: on_success
+      variables:
+        TAG_NAME: latest
+  script:
+    - HELM_TAG=$(grep -E -o "(version:)(.*)" helm/manifest-service/Chart.yaml | sed -E 's/.*version:[[:space:]](.*)/\1/g')
+    - export HELM_EXPERIMENTAL_OCI=1
+    - helm registry login registry.open-xchange.com -u "$OX_REGISTRY_USER" -p "$OX_REGISTRY_TOKEN"
+    - helm chart save helm/manifest-service registry.open-xchange.com//frontend/manifest-service:$TAG_NAME
+    - helm chart save helm/manifest-service registry.open-xchange.com//frontend/manifest-service
+    - helm chart push registry.open-xchange.com//frontend/manifest-service:$TAG_NAME
+    - helm chart push registry.open-xchange.com//frontend/manifest-service:$HELM_TAG
+  tags:
+    - kubernetes
+
+
 # Helm is used for deploying everything to kubernetes
 # Afterwards we do a rolling restart of our deployment
 deploy:
-- 
GitLab