thematdevdotorg/.gitlab-ci.yml
2021-02-12 18:01:21 +03:00

27 lines
783 B
YAML

image: python:latest
stages:
- deploy
.ssh:
before_script:
- 'which ssh-agent || ( apt update -y && apt install openssh-client -y )'
- 'which rsync || ( apt update -y && apt install rsync -y )'
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- 'echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- ssh-add <(echo $PRIVATE_KEY | base64 -d)
.deploy:
stage: deploy
extends: .ssh
script:
- rsync -rlt --delete --exclude={'.env','.git','.gitignore'} ./ $REMOTE_USER@$REMOTE_HOST:$REMOTE_PATH/
- ssh $REMOTE_USER@$REMOTE_HOST "cd $REMOTE_PATH && pipenv install"
- ssh $REMOTE_USER@$REMOTE_HOST "sudo systemctl restart $SYSTEMD_UNIT"
deploy_prod:
extends: .deploy
environment:
name: production
url: https://thematdev.org