From 7516aefb740fff0255640ce3ebc47025ee29cc01 Mon Sep 17 00:00:00 2001
From: Sergey Latyshkov <serg.latyshkov@gmail.com>
Date: Wed, 30 Mar 2022 10:24:14 +0700
Subject: [PATCH] [ITDEPT-148] Adding CI

---
 .gitlab-ci.yml | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..f35c25ad
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,20 @@
+publish:
+  image: curlimages/curl:latest
+  stage: build
+  rules:
+    - if: $CI_COMMIT_TAG
+  variables:
+    URL: "$CI_SERVER_PROTOCOL://$CI_SERVER_HOST:$CI_SERVER_PORT/api/v4/projects/$CI_PROJECT_ID/packages/composer?job_token=$CI_JOB_TOKEN"
+  script:
+    - version=$([[ -z "$CI_COMMIT_TAG" ]] && echo "branch=$CI_COMMIT_REF_NAME" || echo "tag=$CI_COMMIT_TAG")
+    - insecure=$([ "$CI_SERVER_PROTOCOL" = "http" ] && echo "--insecure" || echo "")
+    - response=$(curl -s -w "\n%{http_code}" $insecure --data $version $URL)
+    - code=$(echo "$response" | tail -n 1)
+    - body=$(echo "$response" | head -n 1)
+    # Output state information
+    - if [ $code -eq 201 ]; then
+        echo "Package created - Code $code - $body";
+      else
+        echo "Could not create package - Code $code - $body";
+        exit 1;
+      fi
-- 
GitLab