From 8b1e91479172823a4febd0510e4429433542c76a Mon Sep 17 00:00:00 2001 From: Vladimir Hodakov Date: Sun, 28 Oct 2018 21:14:17 +0400 Subject: [PATCH] Add deploy via SSH --- .gitlab-ci.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9206ca3..07cee38 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,7 +13,17 @@ build site: stage: build script: - bundle exec jekyll build -d lorchess.ru - artifacts: - expire_in: 1 month - paths: - - lorchess.ru + +deploy site: + stage: deploy + only: + - master + before_script: + - mkdir -p ~/.ssh + - echo "$DEPLOY_SSH_KEY" | tr -d '\r' > ~/.ssh/id_rsa + - chmod 600 ~/.ssh/id_rsa + - eval "$(ssh-agent -s)" + - ssh-add ~/.ssh/id_rsa + - ssh-keyscan -H $DEPLOY_SSH_HOST >> ~/.ssh/known_hosts + script: + - scp -r lorchess.ru $DEPLOY_SSH_USER@$DEPLOY_SSH_HOST:$DEPLOY_PATH \ No newline at end of file