From 2fb93ad6ab65559c9b4723f6aab8b7c2a648a3f7 Mon Sep 17 00:00:00 2001
From: dboe <dboe@ipp.mpg.de>
Date: Tue, 7 Jul 2020 18:48:05 +0200
Subject: [PATCH] release docs and dist

---
 .gitlab-ci.yml | 54 ++++++++++++++++++++++++++++++--------------------
 1 file changed, 33 insertions(+), 21 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 2e83a64..5b8d7da 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,21 +28,20 @@ before_script:
   # hack because of bug in setuptools (Optimal would be 'pip install .' but install_requires in setup.cfg not read. See https://github.com/pypa/setuptools/issues/456)
   - python -c "import configparser; config = configparser.ConfigParser(); config.read('setup.cfg'); deps = config['metadata']['install_requires'].split('\n'); import subprocess; subprocess.call(['pip', 'install'] + [x for x in deps if x])"
 
-    # dist:
-    #   stage: build
-    #   script:
-    #     - python setup.py bdist_wheel
-    #     # an alternative approach is to install and run:
-    #     - pip install dist/*
-    #     # run the command here
-    #   artifacts:
-    #     paths:
-    #       - dist/*.whl
-    #     expire_in: 1h
-    #   only:
-    #     - tags
-    #     - master
-    # 
+dist:
+  stage: build
+  script:
+    - python setup.py bdist_wheel
+    # an alternative approach is to install and run:
+    - pip install dist/*
+    # run the command here
+  artifacts:
+    paths:
+      - dist/*.whl
+    expire_in: 1h
+  only:
+    - tags
+
     # flake8:
     #   stage: test
     #   before_script:
@@ -60,16 +59,16 @@ before_script:
     #     - tox
 
 pages:
-  stage: publish
+  stage: build
   script:
     - pip install sphinx sphinx_rtd_theme recommonmark
-    - rm -rf public/
-    - mkdir -p public
     - cd docs
     - make html
-    - mv _build/html/* ../public/  # add it to pages
     - cd ..
-
+    - mv docs/_build/html/* docs/  # add it to pages
+    - cp -r docs public  # add it to pages
+  only:
+    - tags
       # - echo $CI_COMMIT_REF_NAME
       # - echo $CI_COMMIT_TAG
       # - if [[ "$CI_COMMIT_REF_NAME" = "master" && "$CI_COMMIT_TAG" = "" ]]; then
@@ -98,7 +97,7 @@ pages:
   artifacts:
     paths:
       - public
-
+      - docs
         # pypi:
         #   image: docker.km3net.de/base/python:3
         #   stage: publish
@@ -112,3 +111,16 @@ pages:
         #     # - /^release-.*$/
         #   except:
         #     - branches
+
+
+release:
+  image: inetprocess/gitlab-release
+  stage: publish
+  only:
+    - tags
+  except:
+    - schedules
+  dependencies:
+    - dist
+  script:
+    - gitlab-release --message 'Automatic release' docs/ dist/
-- 
GitLab