From cfdd1f9d5e2665c89f78aeca73f17ec4ca89b4bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire?= <gregoire.kubler@proton.me>
Date: Fri, 20 Sep 2024 11:45:10 +0200
Subject: [PATCH] feat : created dedicated deploy file to avoid mixing includes

---
 .../release/cibuildwheel_ubuntu.gitlab-ci.yml |  1 +
 .../cibuildwheel_windows.gitlab-ci.yml        |  1 +
 .gitlab/ci/release/deploy.gitlab-ci.yml       | 49 ++++++++++++++++++
 .gitlab/ci/release/pip.gitlab-ci.yml          |  1 +
 .gitlab/ci/release/template.gitlab-ci.yml     | 50 -------------------
 5 files changed, 52 insertions(+), 50 deletions(-)
 create mode 100644 .gitlab/ci/release/deploy.gitlab-ci.yml

diff --git a/.gitlab/ci/release/cibuildwheel_ubuntu.gitlab-ci.yml b/.gitlab/ci/release/cibuildwheel_ubuntu.gitlab-ci.yml
index b0636f7..724ae2c 100644
--- a/.gitlab/ci/release/cibuildwheel_ubuntu.gitlab-ci.yml
+++ b/.gitlab/ci/release/cibuildwheel_ubuntu.gitlab-ci.yml
@@ -1,5 +1,6 @@
 include:
   - local: '/.gitlab/ci/release/template.gitlab-ci.yml'
+  - local: '/.gitlab/ci/release/deploy.gitlab-ci.yml'
 
 release:pip:ubuntu:
   extends: .release:pip:template
diff --git a/.gitlab/ci/release/cibuildwheel_windows.gitlab-ci.yml b/.gitlab/ci/release/cibuildwheel_windows.gitlab-ci.yml
index 10f3bb9..3ff6ad1 100644
--- a/.gitlab/ci/release/cibuildwheel_windows.gitlab-ci.yml
+++ b/.gitlab/ci/release/cibuildwheel_windows.gitlab-ci.yml
@@ -1,5 +1,6 @@
 include:
   - local: '/.gitlab/ci/release/template.gitlab-ci.yml'
+  - local: '/.gitlab/ci/release/deploy.gitlab-ci.yml'
 
 release:pip:windows:
   extends: .release:pip:template
diff --git a/.gitlab/ci/release/deploy.gitlab-ci.yml b/.gitlab/ci/release/deploy.gitlab-ci.yml
new file mode 100644
index 0000000..49dd7a1
--- /dev/null
+++ b/.gitlab/ci/release/deploy.gitlab-ci.yml
@@ -0,0 +1,49 @@
+##################################
+# DEPLOY
+include:
+  - project: "eclipsefdn/it/releng/gitlab-runner-service/gitlab-ci-templates"
+    file: "jobs/secrets.gitlab-ci.yml"
+
+.deploy:template:
+  stage: deploy
+  tags: 
+    - origin:eclipse # allow to target eclipse runner that holds the key for pypi upload
+  image : eclipsecbi/buildpack-deps
+  extends: 
+    - .rules:deploy
+    - .secrets # given by the file included just above
+  id_tokens:
+        VAULT_ID_TOKEN:
+          aud: https://gitlab.eclipse.org
+  secrets:
+    TWINE_USERNAME:
+      vault: $EF_PROJECT_ID/pypi.org/username@cbi
+      file: false
+    TWINE_PASSWORD:
+      vault: $EF_PROJECT_ID/pypi.org/api-token@cbi
+      file: false
+
+  before_script: 
+    - curl https://bootstrap.pypa.io/get-pip.py  --output getpip.py
+    - python3 getpip.py --break-system-packages
+    - python3 -m pip install twine --break-system-packages
+
+  script:
+    - export WHEELS=$(find wheelhouse/ -name "$CI_PROJECT_NAME*.whl")
+    - echo "WHEELS FOUND :$WHEELS"
+    - echo $TWINE_USERNAME
+    - echo $TWINE_PASSWORD
+    - python3 -m twine upload --verbose $WHEELS
+
+
+.deploy:pip:ubuntu:template:
+  needs: [release:pip:ubuntu]
+  extends: 
+    - .deploy:template
+    - .rules:deploy
+
+.deploy:pip:windows:template:
+  needs: [release:pip:windows]
+  extends: 
+    - .deploy:template
+    - .rules:deploy
diff --git a/.gitlab/ci/release/pip.gitlab-ci.yml b/.gitlab/ci/release/pip.gitlab-ci.yml
index 50cff3c..1b45a08 100644
--- a/.gitlab/ci/release/pip.gitlab-ci.yml
+++ b/.gitlab/ci/release/pip.gitlab-ci.yml
@@ -1,5 +1,6 @@
 include:
   - local: '/.gitlab/ci/release/template.gitlab-ci.yml'
+  - local: '/.gitlab/ci/release/deploy.gitlab-ci.yml'
 
 release:pip:ubuntu:
   extends: .release:pip:template
diff --git a/.gitlab/ci/release/template.gitlab-ci.yml b/.gitlab/ci/release/template.gitlab-ci.yml
index bccf820..7a43395 100644
--- a/.gitlab/ci/release/template.gitlab-ci.yml
+++ b/.gitlab/ci/release/template.gitlab-ci.yml
@@ -13,53 +13,3 @@ include:
     paths:   
       - wheelhouse/ 
     expire_in: 1 week
-
-##################################
-# DEPLOY
-include:
-  - project: "eclipsefdn/it/releng/gitlab-runner-service/gitlab-ci-templates"
-    file: "jobs/secrets.gitlab-ci.yml"
-
-.deploy:template:
-  stage: deploy
-  tags: 
-    - origin:eclipse # allow to target eclipse runner that holds the key for pypi upload
-  image : eclipsecbi/buildpack-deps
-  extends: 
-    - .rules:deploy
-    - .secrets # given by the file included just above
-  id_tokens:
-        VAULT_ID_TOKEN:
-          aud: https://gitlab.eclipse.org
-  secrets:
-    TWINE_USERNAME:
-      vault: $EF_PROJECT_ID/pypi.org/username@cbi
-      file: false
-    TWINE_PASSWORD:
-      vault: $EF_PROJECT_ID/pypi.org/api-token@cbi
-      file: false
-
-  before_script: 
-    - curl https://bootstrap.pypa.io/get-pip.py  --output getpip.py
-    - python3 getpip.py --break-system-packages
-    - python3 -m pip install twine --break-system-packages
-
-  script:
-    - export WHEELS=$(find wheelhouse/ -name "$CI_PROJECT_NAME*.whl")
-    - echo "WHEELS FOUND :$WHEELS"
-    - echo $TWINE_USERNAME
-    - echo $TWINE_PASSWORD
-    - python3 -m twine upload --verbose $WHEELS
-
-
-.deploy:pip:ubuntu:template:
-  needs: [release:pip:ubuntu]
-  extends: 
-    - .deploy:template
-    - .rules:deploy
-
-.deploy:pip:windows:template:
-  needs: [release:pip:windows]
-  extends: 
-    - .deploy:template
-    - .rules:deploy
-- 
GitLab