.gitlab-ci.yml 1.26 KB
Newer Older
1
image: ruby:alpine
Davide Depau's avatar
Davide Depau committed
2

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 16 17 18
  - apk add build-base libressl git bash
  - id
  - ls -lah /usr/gem && true
  - mkdir -p /usr/gem/cache
  - ls -lah /usr/gem && true
  - ls -lah /usr/gem/cache
19 20 21
  - apk add npm
  - npm install
  - bundle install
Davide Depau's avatar
Davide Depau committed
22
  - ./scripts/ci_fix_baseurl.sh
23
  - jekyll build -d public 2>&1 | grep -v 'Using the last argument as keyword parameters is deprecated'
Davide Depau's avatar
Davide Depau committed
24
  - ./scripts/purgecss.sh public
Davide Depau's avatar
Davide Depau committed
25
  - ./scripts/minifycssjs.sh public
26
  - ./scripts/add_mailinglist_symlink.sh public
27

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

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