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

Davide Depau's avatar
Davide Depau committed
11
# Build is in `before_script` because it's the same for both deployments
12
before_script:
13 14 15
  - mkdir -p usr-local-bundle
  - rm -Rf /usr/local/bundle || true
  - ln -sf "$(pwd)/usr-local-bundle" /usr/local/bundle
16 17 18
  - apk add npm
  - npm install
  - bundle install
Davide Depau's avatar
Davide Depau committed
19
  - ./scripts/ci_fix_baseurl.sh
Davide Depau's avatar
Davide Depau committed
20
  - jekyll build -d public
Davide Depau's avatar
Davide Depau committed
21
  - ./scripts/purgecss.sh public
Davide Depau's avatar
Davide Depau committed
22
  - ./scripts/minifycssjs.sh public
23

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

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