diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000000000000000000000000000000000000..a501fa8be344e74d8eb0bd8ea0683cfe00b7e191
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,9 @@
+publish:
+  stage: deploy
+  image: python:3.7
+  script:
+  - pip install build twine
+  - PACKAGE_VERSION="${CI_COMMIT_TAG#v}" python -m build
+  - python -m twine upload --repository-url ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/pypi dist/*
+  rules:
+    - if: '$CI_COMMIT_TAG =~ /v[0-9]+[.][0-9]+[.][0-9]+.*/'
diff --git a/setup.py b/setup.py
index ddeba47cca1f6e1d5f54300ce623c48cce9cefdc..3c83100789a2dd2bdbba4ef77a13fb804eb4d888 100644
--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,4 @@
+import os
 import setuptools
 
 with open('README.md', 'r', encoding='utf-8') as f:
@@ -5,7 +6,7 @@ with open('README.md', 'r', encoding='utf-8') as f:
 
 setuptools.setup(
 	name='ldapserver',
-	version='0.0.1.dev0',
+	version=os.environ.get('PACKAGE_VERSION', 'local'),
 	author='Julian Rother',
 	author_email='python-ldapserver@jrother.eu',
 	description='LDAP server request handler',