-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
36 lines (36 loc) · 1.21 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
image: ubuntu:18.04
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
- venv/
policy: pull-push
stages:
- deploy
deploy:
stage: deploy
before_script:
- apt-get update -qy
- apt-get install -y curl python3 python3-pip locales rsync nodejs npm openssh-client
- pip3 install virtualenv
- npm install -g n
- n latest
- echo "en_US UTF-8" > /etc/locale.gen
- locale-gen en_US.UTF-8
- export LANG=en_US.UTF-8
- export LANGUAGE=en_US:en
- export LC_ALL=en_US.UTF-8
- export PYTHONPATH=$PYTHONPATH:.
script:
- if [ ! -n "$SERVER_SSH_KEY" ]; then exit 0; fi
- mkdir ~/.ssh
- chmod 700 ~/.ssh
- echo "$SERVER_SSH_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- make setup
- make SITE=src/site-prod.yml
- echo "Deploying $CI_COMMIT_REF_NAME..."
- if [ "$CI_COMMIT_REF_NAME" = "master" ]; then export DIRECTORY=master; fi;
- if [ "$CI_COMMIT_REF_NAME" = "staging" ]; then export DIRECTORY=staging; fi;
# we deploy the site
- if [ -n "$CI_COMMIT_REF_NAME" ]; then rsync --delete -avh -e "ssh -o StrictHostKeyChecking=no -o identityFile=~/.ssh/id_rsa" build/ $USER@$HOST:$BASE_DIRECTORY/$DIRECTORY/; fi;