From 8a378f089781c048539d685305cecb9acd0a1c17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mateusz=20=C5=BBebrak?= <mzebrak@syncad.com>
Date: Fri, 29 Sep 2023 08:21:11 +0200
Subject: [PATCH] Extract the common part - deploy_wheel_base

---
 templates/python_projects.gitlab-ci.yml | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/templates/python_projects.gitlab-ci.yml b/templates/python_projects.gitlab-ci.yml
index 05dd92e..d8fbff9 100644
--- a/templates/python_projects.gitlab-ci.yml
+++ b/templates/python_projects.gitlab-ci.yml
@@ -101,7 +101,7 @@ variables:
 
 # >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| DEPLOY |>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 
-.deploy_wheel_template:
+.deploy_wheel_base:
   extends: .configuration_template
   when: manual
   variables:
@@ -110,13 +110,6 @@ variables:
   before_script:
     - !reference [.configuration_template, before_script]
     - rm build_wheel.env  # to keep the git status clean
-  script:
-    - echo -e "${TXT_BLUE}Deploying python wheel...${TXT_CLEAR}"
-    - ls -al
-    - poetry version
-    - poetry config repositories.gitlab "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi"
-    - poetry config http-basic.gitlab gitlab-ci-token "${CI_JOB_TOKEN}"
-    - poetry publish --repository gitlab
   after_script:
     # Job extending this template will depend on the build_wheel job, so we can use the same variable and pass it further
     # so jobs depending on deploy_wheel won't have to include build_wheel also just to get the version
@@ -129,4 +122,14 @@ variables:
     reports:
       dotenv: deploy_wheel.env
 
+.deploy_wheel_to_gitlab_template:
+  extends: .deploy_wheel_base
+  script:
+    - echo -e "${TXT_BLUE}Deploying python wheel to the GitLab PyPI registry...${TXT_CLEAR}"
+    - ls -al
+    - poetry version
+    - poetry config repositories.gitlab "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi"
+    - poetry config http-basic.gitlab gitlab-ci-token "${CI_JOB_TOKEN}"
+    - poetry publish --repository gitlab
+
 # <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<| DEPLOY |<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-- 
GitLab