From 3dee58c327da04337b8f70f94f5c960919e5c5d3 Mon Sep 17 00:00:00 2001
From: Bert Palm <bert.palm@ufz.de>
Date: Thu, 27 Jul 2023 13:39:55 +0200
Subject: [PATCH] ci

---
 .gitlab-ci.yml | 13 ++++++++-----
 setup.py       | 10 +++++-----
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3f3f1e5ec..5c1db6e65 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -182,17 +182,20 @@ docs:
 testpypi:
   stage: deploy
   only:
-    - develop
+    refs:
+      - develop
+      - rolling-release
   except:
     - schedules
   variables:
-    RELEASE: DEVELOP
-    TESTPYPI_USER: __token__
-    TESTPYPI_USER: __token__
+    PYPI_PKG_NAME: "saqc-dev"  # used in setup.py
+    TWINE_USERNAME: __token__
+    TWINE_PASSWORD: $TESTPYPI_TOKEN
   script:
     - pip install build twine
     - python -m build
-    - twine upload -r testpypi -u __token__ -p $TESTPYPI_USER dist/*
+    - twine check --strict dist/*
+    - twine upload -r testpypi dist/*
 
 # make html docu with sphinx
 pages:
diff --git a/setup.py b/setup.py
index f38a0d8af..8ef362c4d 100644
--- a/setup.py
+++ b/setup.py
@@ -12,13 +12,13 @@ with open("README.md", "r") as fh:
     long_description = fh.read()
 
 
-if os.environ.get("RELEASE") == "DEVELOP":
-    name = "saqc-dev"
-else:
-    name = "saqc"
+name = os.environ.get("PYPI_PKG_NAME", "saqc")
+if not name:
+    raise ValueError(
+        "Environment variable PYPI_PKG_NAME must not be an empty string."
+    )
 
 version = versioneer.get_version()
-
 if "dirty" in version:
     raise ValueError(
         f"The repository you build is dirty. Please commit changes first. {version=}"
-- 
GitLab