From 70e4cf249f3dd572781618a251331c3be3c003ca Mon Sep 17 00:00:00 2001 From: runebaas Date: Mon, 15 Jan 2018 18:40:54 +0100 Subject: [PATCH] Add Auto Deployment --- .gitlab-ci.yml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0277327..ecbead2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,12 +1,36 @@ -image: microsoft/dotnet:2.0.3-sdk-stretch +stages: + - build + - deploy before_script: - set -e - set -u - set -o pipefail - build: + stage: build + image: microsoft/dotnet:2.0.3-sdk-stretch + artifacts: + expire_in: 1h + paths: + - Geekbot.net/Binaries/ script: - dotnet restore - - dotnet build + - dotnet publish --configuration Release -o Binaries ./ + +deploy: + stage: deploy + image: instrumentisto/rsync-ssh + only: + - master + dependencies: + - build + before_script: + - eval $(ssh-agent -s) + - mkdir -p ~/.ssh + - '[[ -f /.dockerenv ]] && echo -e "Host *\n StrictHostKeyChecking no" > ~/.ssh/config' + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null + - chmod 700 ~/.ssh + script: + - rsync -rav -e "ssh -p 65432" ./Geekbot.net/Binaries/* www-data@31.220.42.224:$DEPPATH + - ssh -p 65432 www-data@31.220.42.224 "sudo systemctl restart geekbot.service" \ No newline at end of file