From 9616036cb891594dbf941a9b6cb0c6fd02dd4c51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Tint=C3=B3?= <oriol.tinto@lmu.de> Date: Mon, 17 Apr 2023 11:45:12 +0200 Subject: [PATCH] Update .gitlab-ci.yml to add automatic package release. --- .gitlab-ci.yml | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f820317..75c8bf0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,8 @@ stages: - test - - examples + - deploy_test + - test_install + - deploy_prod test_docker: stage: test @@ -12,3 +14,35 @@ test_docker: - export DEBIAN_FRONTEND=noninteractive - apt install -yq git python3 python3-pip python3-venv script: ./run_tests.sh + rules: + - if: '$CI_COMMIT_TAG == null' + +deploy to testpypi: + stage: deploy_test + image: python:3.8 + only: + - tags + script: + - pip install twine + - python setup.py sdist bdist_wheel + - twine upload -u $PYPI_TEST_USER -p $PYPI_TEST_PASSWORD --repository-url https://test.pypi.org/legacy/ --skip-existing dist/* + +install from testpypi: + stage: test_install + image: python:3.8 + needs: ["deploy to testpypi"] + script: + - pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ enstools-encoding + artifacts: + when: on_failure + paths: + - "*.log" + +deploy to pypi: + stage: deploy_prod + image: python:3.8 + needs: ["install from testpypi"] + script: + - pip install twine + - python setup.py sdist bdist_wheel + - twine upload -u $PYPI_USERNAME -p $PYPI_PASSWORD --skip-existing dist/* \ No newline at end of file -- GitLab