From 2c3d47cf7dcc2b6e2fd52b9429968c07b0dc2c49 Mon Sep 17 00:00:00 2001
From: Sonia Zorba <sonia.zorba@inaf.it>
Date: Thu, 4 Nov 2021 19:18:02 +0100
Subject: [PATCH] CI: added upload of jar as generic repo package

---
 .gitlab-ci.yml | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b6f236d..f2a1cf2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -2,6 +2,7 @@ stages:
   - build
   - test
   - deploy
+  - publish
 
 .gms_client:
   tags:
@@ -29,7 +30,7 @@ test_gms_client:
   script:
     - cd gms-client/gms-client
     - mvn clean test
-
+    
 test_gms:
   stage: test
   tags:
@@ -82,3 +83,14 @@ dockerize_gms:
       changes:
         - gms/*
         - gms-ui/*
+
+upload_jar:
+  stage: publish
+  tags:
+    - shell
+  only:
+    - master
+  script:
+    # extract jar from Docker image
+    - docker run --rm --entrypoint cat "${CI_REGISTRY_IMAGE}" /gms.jar > gms.jar
+    - 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file gms.jar "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/gms/latest/gms.jar"'
-- 
GitLab