diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..59224dc --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,17 @@ +stages: + - deploy + +deploy: + stage: deploy + image: node:latest + before_script: + - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )' + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - ssh-keyscan repo.kinesis.games >> ~/.ssh/known_hosts + - chmod 644 ~/.ssh/known_hosts + - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' + script: + - ssh ubuntu@kinesis.games "cd /var/www/proximity-demo/ && sudo bash buildScript.sh" diff --git a/buildScript.sh b/buildScript.sh new file mode 100755 index 0000000..efbe54c --- /dev/null +++ b/buildScript.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +git pull origin master +npm i +npm run-script build +chown -R root:www-data . +systemctl reload apache2