From b3ec71aaa45f614829b04156f57cd803b332efa1 Mon Sep 17 00:00:00 2001
From: Moul <moul@moul.re>
Date: Sat, 7 Sep 2019 16:05:28 +0200
Subject: [PATCH] [enh] #105: Set-up CD: Add PyPi and PyPi test distribution

- manual and on tags trigger
---
 .gitlab-ci.yml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 62cc5576..57a34369 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,6 +1,7 @@
 stages:
   - checks
   - tests
+  - publish
   - coverage
 
 variables:
@@ -69,6 +70,23 @@ tests-3.8:
   variables:
     PYTHON_VERSION: "3.8"
 
+pypi_test:
+  stage: publish
+  only: [tags]
+  when: manual
+  script:
+    - mkdir -p /root/.config/pypoetry/
+    - touch /root/.config/pypoetry/config.toml
+    - poetry config repositories.pypi_test https://test.pypi.org/legacy/
+    - poetry publish --build --username $PYPI_TEST_LOGIN --password $PYPI_TEST_PASSWORD --repository pypi_test
+
+pypi:
+  stage: publish
+  only: [tags]
+  when: manual
+  script:
+    - poetry publish --build --username $PYPI_LOGIN --password $PYPI_PASSWORD
+
 pages:
   extends: .code_changes
   needs: [tests-3.7-coverage]
-- 
GitLab