.gitlab-ci.yml 1.06 KB
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:
13 14 15
    - (cd ./_posts; git pull origin $CI_COMMIT_REF_NAME)
    - (cd ./_data/courses; git pull origin $CI_COMMIT_REF_NAME)
    - (cd ./_data/coding_gym; git pull origin $CI_COMMIT_REF_NAME)
kael_k's avatar
kael_k committed
16
    - mkdir public
17
    - chown -R jekyll:jekyll ./
Roberto Bochet's avatar
Roberto Bochet committed
18
    - ./scripts/ci_fix_baseurl.sh
kael_k's avatar
kael_k committed
19 20
    - jekyll build -d public
  artifacts:
Davide Depau's avatar
Davide Depau committed
21
    paths:
kael_k's avatar
kael_k committed
22 23
      - public
    expire_in: 1 day
24
  only:
kael_k's avatar
kael_k committed
25 26
    - develop
    - master
27

Roberto Bochet's avatar
Roberto Bochet committed
28
pages:
29
  stage: deploy
Davide Depau's avatar
Davide Depau committed
30
  script:
Davide Depau's avatar
Davide Depau committed
31
    - echo "Already built."
Davide Depau's avatar
Davide Depau committed
32 33
  artifacts:
    paths:
kael_k's avatar
kael_k committed
34 35 36 37
      - public
  only:
    - develop

Roberto Bochet's avatar
Roberto Bochet committed
38
deploy:
kael_k's avatar
kael_k committed
39 40 41 42 43 44 45 46 47
  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
48
  only:
kael_k's avatar
kael_k committed
49
    - master