.gitlab-ci-mkdocs.yml 1.07 KB
Newer Older
Lukas Wiest's avatar
Lukas Wiest committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

cache:
  paths:
    - .cache/pip
    - venv/

mkdocs:compile:
  stage: compile
  image: python:3.8
  tags:
    - docker
  before_script:
    - pip install virtualenv
    - virtualenv venv
    - source venv/bin/activate
  script:
    - pip install -r requirements.txt -U
    - mkdocs build --strict
  only:
    changes:
      - docs/**/*
      - mkdocs.yml
  artifacts:
    expire_in: 3h
    paths:
      - site/

mkdocs:bundle:
  stage: deploy
  image: alpine
  tags:
    - docker
  script:
    - tar c -zvf documentation.tar.gz site
  needs:
    - mkdocs:compile
  only:
    changes:
      - docs/**/*
      - mkdocs.yml
  artifacts:
    expire_in: 3 days
    paths:
      - ./*.tar.gz

mkdocs:deploy:
  stage: deploy
  tags:
    - production
  variables:
    EXPORT_DIR: "/var/www/html/pages"
    PROJECT_NAME: "dtt"
  script:
    - mkdir -p "$EXPORT_DIR/$PROJECT_NAME"
    - cp -r site/* "$EXPORT_DIR/$PROJECT_NAME"
  needs:
    - mkdocs:compile
  only:
    refs:
Lukas Wiest's avatar
Lukas Wiest committed
63
      - master
Lukas Wiest's avatar
Lukas Wiest committed
64
65
66
    changes:
      - docs/**/*
      - mkdocs.yml