-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
39 lines (34 loc) · 1.1 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# This file is a template, and might need editing before it works on your project.
# Official framework image. Look for the different tagged releases at:
# https://hub.docker.com/r/library/node/tags/
image: node:latest
cache:
paths:
- node_modules/
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIV_KEY" | tr -d '\r' | ssh-add - > /dev/null
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
stages:
- test
- deploy
test_coverage:
stage: test
script:
- npm install
- npm install --global mocha nyc
- npm run coverage
deploy_prod:
stage: deploy
script:
- echo "Deploying to Production"
- npm install
- ssh [email protected] "cd /opt/website && git pull && npm install && bash -c \"pm2 stop LeviOlson && pm2 delete LeviOlson && pm2 start app.js --name LeviOlson --watch && pm2 logs --nostream --lines 2 LeviOlson && exit 0\" && exit 0"
environment:
name: production
url: https://leviolson.com
only:
- master