.gitlab-ci.yml 1.02 KB
Newer Older
Christophe Benz's avatar
Christophe Benz 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
variables:
  SCHEMA_JSON: schema.json
  SCHEMA_MD: schema.md

build_schema_doc:
  stage: build
  image: node:10
  only:
    changes:
      - $SCHEMA_JSON
  variables:
    LC_ALL: fr_FR.utf8
  before_script:
    - npm install -g @opendataschema/table-schema-to-markdown
  script:
    - table-schema-to-markdown $SCHEMA_JSON > $SCHEMA_MD
  artifacts:
    paths:
      - $SCHEMA_MD

commit_schema_md:
  stage: deploy
  image: git.opendatafrance.net:4567/scdl/documentation
  only:
    changes:
      - $SCHEMA_JSON
  before_script:
    - eval $(ssh-agent -s)
    - ssh-add <(echo "$SSH_PRIVATE_KEY")
    - mkdir -p ~/.ssh
    - ssh-keyscan -t rsa git.opendatafrance.net >> ~/.ssh/known_hosts
    - git config --global user.email "table-schema-to-markdown"
    - git config --global user.name "Table Schema to Markdown bot"
  script:
    - git clone --branch $CI_COMMIT_REF_NAME $CI_REPOSITORY_URL
    - mv $SCHEMA_MD $CI_PROJECT_NAME
    - cd $CI_PROJECT_NAME
    - git add $SCHEMA_MD
    - git commit -m "Update $SCHEMA_MD" || true
    - git push