diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 88d5caa..7568698 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,8 @@ stages: # List of stages for jobs, and their order of execution - test - deploy +image: debian + docker-build: # Use the official docker image. image: docker:latest @@ -29,5 +31,23 @@ docker-build: - if: $CI_COMMIT_BRANCH exists: - Dockerfile - - if: $CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "dev" + - if: ($CI_COMMIT_BRANCH == "master" || $CI_COMMIT_BRANCH == "dev") when: always + +before_script: + - apt-get update -qq + - apt-get install -qq git + # Setup SSH deploy keys + - 'which ssh-agent || ( apt-get install -qq openssh-client )' + - eval $(ssh-agent -s) + - ssh-add <(echo "$SSH_PRIVATE_KEY") + - mkdir -p ~/.ssh + - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + +deploy_staging: + type: deploy + script: + - ssh $SSH_SERVER "cd /root && docker-compose up -d shbot && exit" + only: + - master + \ No newline at end of file