.gitlab-ci.yml 1.15 KB
Newer Older
1 2 3 4
stages:
  - build_docker_image
  - build
  - deploy
Christophe Benz's avatar
Christophe Benz committed
5

Christophe Benz's avatar
fixup!  
Christophe Benz committed
6 7
variables:
  PDF_FILE: Socle Commun des Données Locales.pdf
8 9 10 11 12 13 14 15 16 17 18 19 20
  IMAGE_TAG: $CI_REGISTRY_IMAGE:latest

build_docker_image:
  stage: build_docker_image
  image: docker:stable
  services:
    - docker:dind
  variables:
    DOCKER_HOST: tcp://docker:2375
    DOCKER_DRIVER: overlay2
  before_script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
  script:
Christophe Benz's avatar
fixup!  
Christophe Benz committed
21
    - docker build -t $IMAGE_TAG -f Dockerfile.ci .
22 23 24 25 26 27
    - docker push $IMAGE_TAG
  only:
    changes:
      - Dockerfile.ci
  tags:
    - docker-privileged
Christophe Benz's avatar
fixup!  
Christophe Benz committed
28

29
build_gitbook:
30
  image: $IMAGE_TAG
Christophe Benz's avatar
Christophe Benz committed
31
  stage: build
32 33 34 35 36
  script:
    - ./build.sh
  artifacts:
    paths:
      - _book/
Christophe Benz's avatar
fixup!  
Christophe Benz committed
37
      - "$PDF_FILE"
38 39

deploy_gitbook:
40
  image: $IMAGE_TAG
41 42 43 44 45 46 47 48 49
  stage: deploy
  only:
    - master
  before_script:
    # Load SSH agent
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$SSH_PRIVATE_KEY")
    - mkdir -p ~/.ssh
    - ssh-keyscan -t rsa go.validata.fr >> ~/.ssh/known_hosts
Christophe Benz's avatar
Christophe Benz committed
50
  script:
51
    - rsync -avz --delete _book/ "$PDF_FILE" validata@go.validata.fr:scdl-documentation-static/
52 53 54
  environment:
    name: documentation
    url: https://scdl.opendatafrance.net/docs/