.gitlab-ci.yml 1.12 KB
Newer Older
Davide Depau's avatar
Davide Depau committed
1
2
image: jekyll/builder

Davide Depau's avatar
Davide Depau committed
3
4
5
stages:
  - deploy

Davide Depau's avatar
Davide Depau committed
6
7
8
variables:
  JEKYLL_ENV: production
  LC_ALL: C.UTF-8
9
  GIT_SUBMODULE_STRATEGY: recursive
10
  BUNDLE_USER_HOME: ./bundle
Davide Depau's avatar
Davide Depau committed
11

Davide Depau's avatar
Davide Depau committed
12
# Build is in `before_script` because it's the same for both deployments
13
before_script:
Roberto Bochet's avatar
Roberto Bochet committed
14
15
16
  - git submodule update --remote ./_posts/
  - git submodule update --remote ./_data/courses/
  - git submodule update --remote ./_data/coding_gym/
17
  - bundle install
Davide Depau's avatar
Davide Depau committed
18
  - ./scripts/ci_fix_baseurl.sh
alek's avatar
alek committed
19
20
21
  - bundle exec jekyll build
  - mv _site public
  - ln -sf faq_mailinglist/index.html "public/faq_mailinglist.html"
22

Davide Depau's avatar
Davide Depau committed
23
deploy-prod:
24
25
  stage: deploy
  script:
Davide Depau's avatar
Davide Depau committed
26
  - apk add rsync
27
28
  - mkdir -p "$HOME/.ssh"
  - echo "$SSH_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts"
29
30
  - chmod 700 "$HOME/.ssh/known_hosts"
  - chmod 700 "$SSH_DEPLOY_KEY"
Davide Depau's avatar
Davide Depau committed
31
  - rsync -e "ssh -i $SSH_DEPLOY_KEY" --delete-after -rlptP public/ "$SSH_DEPLOY_USER@$SSH_DEPLOY_HOST:/www.poul.org/"
Davide Depau's avatar
Davide Depau committed
32
  cache:
Davide Depau's avatar
Davide Depau committed
33
    key: build-deps
Davide Depau's avatar
Davide Depau committed
34
    paths:
35
      - "bundle/"
36
37
38
39
40
  only:
  - master

pages:
  stage: deploy
Davide Depau's avatar
Davide Depau committed
41
  script:
Davide Depau's avatar
Davide Depau committed
42
    - echo "Already built."
Davide Depau's avatar
Davide Depau committed
43
44
45
  artifacts:
    paths:
    - public
Davide Depau's avatar
Davide Depau committed
46
  cache:
Davide Depau's avatar
Davide Depau committed
47
    key: build-deps
Davide Depau's avatar
Davide Depau committed
48
    paths:
49
      - "bundle/"
Davide Depau's avatar
Davide Depau committed
50
  only:
51
  - develop