.gitlab-ci.yml 1.2 KB
Newer Older
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
stages:
  - site-builder
  - site-publisher

.template: &template
  stage: site-publisher
  image: docker:stable
  services:
    - docker:dind
  dependencies:
    - site-builder
  script:
    - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
    - |
      docker run \
      --rm \
      -e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
      -e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
      -e CRI_BUCKET=${CRI_BUCKET} \
      -v $(pwd)/site:/srv/site \
      registry.cri.epita.fr/cri/docker/arch-cri/master \
      aws s3 --endpoint-url https://s3.cri.epita.fr/ sync /srv/site $CRI_BUCKET --acl public-read --delete

site-builder:
  stage: site-builder
  image:
    name: squidfunk/mkdocs-material:latest
    entrypoint: [""]
  script:
    - mkdocs build
  artifacts:
    expire_in: 1 days
    paths:
      - site

site-publisher:release:
  <<: *template
  only:
    - master
  variables:
    AWS_SECRET_ACCESS_KEY: $cri_doc_secret
    AWS_ACCESS_KEY_ID: $cri_doc_access
    CRI_BUCKET: $cri_doc_bucket

site-publisher:dev:
  <<: *template
  except:
    - master
  variables:
    AWS_SECRET_ACCESS_KEY: $cri_doc_dev_secret
    AWS_ACCESS_KEY_ID: $cri_doc_dev_access
    CRI_BUCKET: $cri_doc_dev_bucket