add Gitlab CI/CD

This commit is contained in:
Kishan Takoordyal 2021-03-04 19:34:57 +04:00
parent 4fd74a694c
commit 769c3e525f
No known key found for this signature in database
GPG Key ID: 304DF64F0804D6A1
2 changed files with 24 additions and 0 deletions

17
.gitlab-ci.yml Normal file
View File

@ -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"

7
buildScript.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
git pull origin master
npm i
npm run-script build
chown -R root:www-data .
systemctl reload apache2