-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
27 lines (27 loc) · 1.05 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
image: ubuntu:18.04
stages:
- deploy
deploy:
stage: deploy
before_script:
- apt-get update -qy
- apt-get install -y python3 python3-pip locales rsync nodejs npm openssh-client
- 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
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
- pip3 install -r requirements.txt
- make npm
- 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 main website
- if [ -n "$CI_COMMIT_REF_NAME" ]; then rsync --delete --progress -r -e "ssh -o StrictHostKeyChecking=no -o identityFile=~/.ssh/id_rsa" build/ $SSH_USER@$SSH_HOST:/algoneer/$DIRECTORY; fi;