From 6c5f5aa51b591293466700b77f8adf564dbcf6b9 Mon Sep 17 00:00:00 2001 From: Benjamin Bertrand <benjamin.bertrand@esss.se> Date: Wed, 7 Feb 2018 16:17:20 +0100 Subject: [PATCH] Add stage to deploy doc to GitLab pages --- .gitlab-ci.yml | 16 ++++++++++++++++ docs/conf.py | 7 ++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 57afb5f..d8ead1a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -61,3 +61,19 @@ deploy-staging: - launch_job_template deploy-csentry-staging only: - master + +pages: + <<: *runner_tags + stage: deploy + image: "$CONTAINER_RELEASE_IMAGE" + before_script: [] + script: + - sphinx-build -M html docs docs/_build + - mv docs/_build/html public + artifacts: + paths: + - public + # CI_COMMIT_TAG is used in docs/conf.py + # Don't forget to update if not only deploying docs for tags + only: + - tags diff --git a/docs/conf.py b/docs/conf.py index 63d04c0..3f9bb76 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -62,7 +62,12 @@ author = 'Benjamin Bertrand' # built documents. # # The short X.Y version. -version = os.popen('git describe').read().strip() +try: + # CI_COMMIT_TAG is defined by GitLab Runner when building tags + version = os.environ['CI_COMMIT_TAG'] +except KeyError: + # dev mode + version = os.popen('git describe').read().strip() # The full version, including alpha/beta/rc tags. release = version -- GitLab