.gitlab-ci.yml 873 Bytes
Newer Older
Davide Depau's avatar
Davide Depau committed
1
stages:
kael_k's avatar
kael_k committed
2
  - build
Davide Depau's avatar
Davide Depau committed
3
  - deploy
Davide Depau's avatar
Davide Depau committed
4
5
6
variables:
  JEKYLL_ENV: production
  LC_ALL: C.UTF-8
7
  GIT_SUBMODULE_STRATEGY: recursive
8

kael_k's avatar
kael_k committed
9
10
11
build:
  image: jekyll/builder:4.0
  stage: build
12
  script:
kael_k's avatar
kael_k committed
13
14
15
16
    - mkdir public
    - chown -R jekyll:jekyll
    - jekyll build -d public
  artifacts:
Davide Depau's avatar
Davide Depau committed
17
    paths:
kael_k's avatar
kael_k committed
18
19
      - public
    expire_in: 1 day
20
  only:
kael_k's avatar
kael_k committed
21
22
    - develop
    - master
23

kael_k's avatar
kael_k committed
24
deploy_pages:
25
  stage: deploy
Davide Depau's avatar
Davide Depau committed
26
  script:
Davide Depau's avatar
Davide Depau committed
27
    - echo "Already built."
Davide Depau's avatar
Davide Depau committed
28
29
  artifacts:
    paths:
kael_k's avatar
kael_k committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
      - public
  only:
    - develop

deploy_prod:
  stage: deploy
  image: alpine:3.13
  script:
    - apk add rsync openssh
    - mkdir -p "$HOME/.ssh"
    - echo "$SSH_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts"
    - chmod 700 "$HOME/.ssh/known_hosts"
    - chmod 700 "$SSH_DEPLOY_KEY"
    - 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
44
  only:
kael_k's avatar
kael_k committed
45
    - master