.gitlab-ci.yml 2.27 KB
Newer Older
cermak's avatar
cermak committed
1
image: ruby:2.6
GitLab's avatar
GitLab committed
2
3
4
5
6
7

variables:
  JEKYLL_ENV: production
  LC_ALL: C.UTF-8

before_script:
cermak's avatar
cermak committed
8
  - gem install bundler
GitLab's avatar
GitLab committed
9
  - bundle install
cermak's avatar
cermak committed
10
11
  - 'which ssh-agent || ( apt-get update -qy && apt-get install openssh-client -qqy )'
  - eval `ssh-agent -s`
cermak's avatar
testz    
cermak committed
12
  - echo "${SSH_PRIVATE_KEY}" | tr -d '\r' | ssh-add - > /dev/null 
cermak's avatar
cermak committed
13
14
  - mkdir -p ~/.ssh
  - chmod 700 ~/.ssh
cermak's avatar
test    
cermak committed
15
  - echo "ssh-rsa ${SSH_PUBLIC_KEY} ${CI_EMAIL}" >> ~/.ssh/id_rsa.pub
cermak's avatar
cermak committed
16
  - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
cermak's avatar
cermak committed
17
18
  - mkdir -p _data
  - cd _data
cermak's avatar
cermak committed
19
20
21
22
23
24
25
26
27
28
29
  - 'echo "{ \"all\": [" > publications.json'
  - 'curl -X GET "https://publons.com/api/v2/academic/publication/?academic=1375240&page=1" -H "Authorization: Token ${PUBLONS_TOKEN}" -H "Content-Type: application/json" >> publications.json'
  - 'echo ", " >> publications.json'
  - 'curl -X GET "https://publons.com/api/v2/academic/publication/?academic=1375240&page=2" -H "Authorization: Token ${PUBLONS_TOKEN}" -H "Content-Type: application/json" >> publications.json'
  - 'echo ", " >> publications.json'
  - 'curl -X GET "https://publons.com/api/v2/academic/publication/?academic=1375240&page=3" -H "Authorization: Token ${PUBLONS_TOKEN}" -H "Content-Type: application/json" >> publications.json'
  - 'echo ", " >> publications.json'
  - 'curl -X GET "https://publons.com/api/v2/academic/publication/?academic=1375240&page=4" -H "Authorization: Token ${PUBLONS_TOKEN}" -H "Content-Type: application/json" >> publications.json'
  - 'echo ", " >> publications.json'
  - 'curl -X GET "https://publons.com/api/v2/academic/publication/?academic=1375240&page=5" -H "Authorization: Token ${PUBLONS_TOKEN}" -H "Content-Type: application/json" >> publications.json'
  - 'echo "] }" >> publications.json'
cermak's avatar
cermak committed
30
  - cd ..
GitLab's avatar
GitLab committed
31
32
33
34
35
36
37
38
39
40
41
42
43
44

test:
  stage: test
  script:
  - bundle exec jekyll build -d test
  artifacts:
    paths:
    - test
  except:
  - master

pages:
  stage: deploy
  script:
cermak's avatar
cermak committed
45
46
47
  - git config --global user.email "${CI_EMAIL}"
  - git config --global user.name "${CI_USERNAME}"
  - git clone git@github.com:me2d09/cermak.science.git public
GitLab's avatar
GitLab committed
48
  - bundle exec jekyll build -d public
cermak's avatar
test    
cermak committed
49
  - cd public
cermak's avatar
cermak committed
50
  - git add -A
cermak's avatar
cermak committed
51
  - git commit -m "Static site build from gitlab ($CI_COMMIT_SHORT_SHA)" || echo "No changes, nothing to commit!"
cermak's avatar
cermak committed
52
53
  - git push
  
GitLab's avatar
GitLab committed
54
55
56
57
58
  artifacts:
    paths:
    - public
  only:
  - master