Commit e6b3efe3 authored by Dimitrios Giannopoulos's avatar Dimitrios Giannopoulos
Browse files

fixes for git and mike

parent e751e817
Loading
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -8,19 +8,20 @@ pages:
  before_script:
    - pip install -q mkdocs-material mike
    - apt-get update -qq && apt-get -qq install -y git > /dev/null
    - git config user.name $GITLAB_USER_NAME
    - git config user.email $GITLAB_USER_EMAIL
    - git config --global --replace-all user.name $GITLAB_USER_NAME
    - git config --global --replace-all user.email $GITLAB_USER_EMAIL
    - git fetch origin $PAGES_BRANCH && git checkout $PAGES_BRANCH || git checkout -b $PAGES_BRANCH origin/$PAGES_BRANCH || echo "Pages branch not deployed yet."
    - git checkout $CI_COMMIT_SHA
  script:
    - git pull --rebase origin $PAGES_BRANCH
    - |
      if [ -n "$CI_COMMIT_TAG" ]; then
        mike deploy --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH -u $CI_COMMIT_TAG latest
        mike set-default --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH latest
      elif [ "$CI_COMMIT_REF_PROTECTED" == "true" ]; then
        mike deploy --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH -u $CI_COMMIT_BRANCH $CI_COMMIT_BRANCH
        mike deploy --deploy-prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH -u $CI_COMMIT_BRANCH
      fi
      git checkout $PAGES_BRANCH -- public/
    - git checkout $PAGES_BRANCH -- public/
  artifacts:
    paths:
      - public/