.gitlab-ci.yml 981 Bytes
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
Davide Depau's avatar
Davide Depau committed
10

11
before_script:
12 13 14
  - apk add npm
  - npm install
  - bundle install
Davide Depau's avatar
Davide Depau committed
15
  - ./scripts/ci_fix_baseurl.sh
Davide Depau's avatar
Davide Depau committed
16
  - jekyll build -d public
Davide Depau's avatar
Davide Depau committed
17
  - ./scripts/purgecss.sh public
Davide Depau's avatar
Davide Depau committed
18
  - ./scripts/minifycssjs.sh public
19

Davide Depau's avatar
Davide Depau committed
20
deploy-prod:
21 22
  stage: deploy
  script:
Davide Depau's avatar
Davide Depau committed
23
  - apk add rsync
24 25
  - mkdir -p "$HOME/.ssh"
  - echo "$SSH_KNOWN_HOSTS" > "$HOME/.ssh/known_hosts"
26 27
  - chmod 700 "$HOME/.ssh/known_hosts"
  - chmod 700 "$SSH_DEPLOY_KEY"
Davide Depau's avatar
Davide Depau committed
28
  - 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
29
  cache:
Davide Depau's avatar
Davide Depau committed
30
    key: build-deps
Davide Depau's avatar
Davide Depau committed
31
    paths:
Davide Depau's avatar
Davide Depau committed
32 33
      - "/usr/local/bundle/"
      - "node_modules/"
34 35 36 37 38
  only:
  - master

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