From 2c017e357a4dbb9ac0956a8f93d33fee40e82b81 Mon Sep 17 00:00:00 2001
From: Juraj Paluba <492988@mail.muni.cz>
Date: Wed, 23 Mar 2022 18:07:55 +0100
Subject: [PATCH] Create setup.cfg and update gitlab ci to create rc tags

---
 .gitlab-ci.yml | 15 +++++----------
 setup.cfg      |  2 ++
 2 files changed, 7 insertions(+), 10 deletions(-)
 create mode 100644 setup.cfg

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 477f3da..9681baa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -27,16 +27,10 @@ build:
   script:
     # Get version. Variable CI_COMMIT_TAG is set only when tag was pushed.
     - export LATEST_TAG=$(git describe --abbrev=0)
-    - export VERSION=$(if [[ "$CI_COMMIT_TAG" == "" ]]; then echo $LATEST_TAG; else echo $CI_COMMIT_TAG; fi)
-    - export VERSION=$(echo $VERSION | cut -c 2-)
-    - python3 setup.py setopt --command=metadata --option=version --set-value=$VERSION
+    - export VERSION=$(if [[ "$CI_COMMIT_TAG" == "" ]]; then echo ""; else echo $CI_COMMIT_TAG | cut -c 2-; fi)
+    - if [[ "$VERSION" != "" ]]; then python3 setup.py setopt --command=metadata --option=version --set-value=$VERSION; fi
     - echo VERSION=$VERSION
-    # Get package filename
-    - export WHEEL_NAME=$(python3 setup.py --name | tr '-' '_')
-    - export PACKAGE=$WHEEL_NAME-$VERSION-$PYTHON_TAG-$ABI_TAG-$PLATFORM_TAG.$PACKAGE_EXTENSION
-    - echo PACKAGE=$PACKAGE
     - python3 setup.py bdist_wheel
-    - echo $PACKAGE > dist/.package-name
   only:
     - branches
     - tags
@@ -51,11 +45,12 @@ deploy:
     TWINE_PASSWORD: '$CI_CUSTOM_REGISTRY_PASSWORD'
     TWINE_USERNAME: '$CI_CUSTOM_REGISTRY_USER'
   script:
-    - export PACKAGE=$(cat dist/.package-name)
     - pip3 install twine
-    - python3 -m twine upload --repository-url $KYPO_PYPI_UPLOAD_URL dist/$PACKAGE
+    - python3 -m twine upload --repository-url $KYPO_PYPI_UPLOAD_URL dist/*
   dependencies:
     - build
   rules:
     - if: $CI_COMMIT_BRANCH == "develop"
+      changes:
+        - setup.cfg
     - if: $CI_COMMIT_TAG
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..8598814
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,2 @@
+[metadata]
+version = v0.1.0rc1
-- 
GitLab