diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 70f955c066941e1f22918595675270a4c5570ae2..f9a4bfb591e742c5703cc73035571345502d7030 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -90,18 +90,31 @@ ragdoc_view: - "pages/docs/ragdoc" pages: - image: python:3.8-buster + image: python:3.10.0-bullseye stage: publish needs: - ragdoc_view - test + variables: + PAGES_BRANCH: pages + HTTPS_REMOTE: https://${PROJECT_BOT_USER}:${PROJECT_BOT_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git before_script: - - pip install -U mkdocs mkdocs-macros-plugin mkdocs-git-revision-date-localized-plugin + - pip install -r pages/requirements.txt + - git config user.name $PROJECT_BOT_USER + - git config user.email $PROJECT_BOT_USER@git-st.inf.tu-dresden.de + - git fetch origin $PAGES_BRANCH || echo "Pages branch not deployed yet." + - git checkout $CI_COMMIT_SHA script: - - cd pages && mkdocs build + - cd pages + - export VERSION=$(python main.py) + - echo $VERSION + - mike list --json --prefix public -r $HTTPS_REMOTE -b $PAGES_BRANCH + - mike deploy --rebase --prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH --update-aliases $VERSION + - cd .. + - git checkout $PAGES_BRANCH -- public/ + artifacts: + paths: + - public/ only: - dev - master - artifacts: - paths: - - public diff --git a/pages/main.py b/pages/main.py index 5f574f69198e31785d5d9a4e2b228d5567d61384..34fc17a618280621b5d737559c8a1839a9e019e7 100644 --- a/pages/main.py +++ b/pages/main.py @@ -1,7 +1,11 @@ +import os + ragconnectVersionFileName = '../ragconnect.base/src/main/resources/ragConnectVersion.properties' def get_version(): + if os.environ.get('CI_COMMIT_BRANCH', 'unknown') == 'dev': + return 'dev' with open(ragconnectVersionFileName) as ragconnectVersionFile: versionFileContent = ragconnectVersionFile.read() return versionFileContent[versionFileContent.rindex('version=') + 8:].strip() diff --git a/pages/requirements.txt b/pages/requirements.txt new file mode 100644 index 0000000000000000000000000000000000000000..43e5e8286a08c67e0f31725821347f38ae4641ef --- /dev/null +++ b/pages/requirements.txt @@ -0,0 +1,4 @@ +mkdocs==1.2.2 +mkdocs-git-revision-date-localized-plugin==0.10.3 +mkdocs-macros-plugin==0.6.3 +mike==1.1.2