Skip to content
Snippets Groups Projects
Commit d00448b0 authored by René Schöne's avatar René Schöne
Browse files

Use mike for versioned documentation

parent 1cdde588
No related branches found
No related tags found
4 merge requests!39Version 1.1.0,!35Version 1.0.0,!17Version 0.3.2,!16Resolve "Make documentation multi-versioned"
Pipeline #11937 passed
...@@ -90,18 +90,31 @@ ragdoc_view: ...@@ -90,18 +90,31 @@ ragdoc_view:
- "pages/docs/ragdoc" - "pages/docs/ragdoc"
pages: pages:
image: python:3.8-buster image: python:3.10.0-bullseye
stage: publish stage: publish
needs: needs:
- ragdoc_view - ragdoc_view
- test - test
variables:
PAGES_BRANCH: pages
HTTPS_REMOTE: https://${PROJECT_BOT_USER}:${PROJECT_BOT_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
before_script: 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: 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: only:
- dev - dev
- master - master
artifacts:
paths:
- public
import os
ragconnectVersionFileName = '../ragconnect.base/src/main/resources/ragConnectVersion.properties' ragconnectVersionFileName = '../ragconnect.base/src/main/resources/ragConnectVersion.properties'
def get_version(): def get_version():
if os.environ.get('CI_COMMIT_BRANCH', 'unknown') == 'dev':
return 'dev'
with open(ragconnectVersionFileName) as ragconnectVersionFile: with open(ragconnectVersionFileName) as ragconnectVersionFile:
versionFileContent = ragconnectVersionFile.read() versionFileContent = ragconnectVersionFile.read()
return versionFileContent[versionFileContent.rindex('version=') + 8:].strip() return versionFileContent[versionFileContent.rindex('version=') + 8:].strip()
......
mkdocs==1.2.2
mkdocs-git-revision-date-localized-plugin==0.10.3
mkdocs-macros-plugin==0.6.3
mike==1.1.2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment