.gitlab-ci-mkdocs.yml 1.05 KB
Newer Older
Lukas Wiest's avatar
Lukas Wiest committed
1

2
3
4
5
6
7
8
9
variables:
  PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"

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

Lukas Wiest's avatar
Lukas Wiest committed
10
11
12
13
14
mkdocs:compile:
  stage: compile
  image: python:3.8
  tags:
    - docker
15
16
17
18
  before_script:
    - pip install virtualenv
    - virtualenv venv
    - source venv/bin/activate
Lukas Wiest's avatar
Lukas Wiest committed
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
  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"
  script:
    - mkdir -p "$EXPORT_DIR/$CI_PROJECT_NAME"
    - cp -r site/* "$EXPORT_DIR/$CI_PROJECT_NAME"
  needs:
    - mkdocs:compile
  only:
    refs:
62
      - master
Lukas Wiest's avatar
Lukas Wiest committed
63
64
65
    changes:
      - docs/**/*
      - mkdocs.yml