-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
56 lines (49 loc) · 1.83 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
image: node:8.11-stretch
stages:
- build
# - test
# - notify
- deploy
cache:
paths:
- node_modules/
install_dependencies:
stage: build
script: "npm install"
artifacts:
paths:
- node_modules/
# run_tests:
# stage: test
# script: "npm run test:remote"
deploy_to_gcp:
stage: deploy
environment:
name: "production"
url: "https://michaelhollister.me"
script:
- "apt-get update -qq && apt-get install -y -qq sshpass"
- "npm run bundle"
- "sshpass -V"
# stop the service
- "sshpass -p \"$REMOTE_PASSWORD\" ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_SERVER} \"/usr/bin/sudo systemctl stop home-api-node\""
# scp the binary
- "sshpass -p \"$REMOTE_PASSWORD\" scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ./bin/home-api-node ${REMOTE_USER}@${REMOTE_SERVER}:/usr/local/bin/home-api-node"
- "sshpass -p \"$REMOTE_PASSWORD\" ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_SERVER} \"/bin/chmod +x /usr/local/bin/home-api-node\""
# start the service
- "sshpass -p \"$REMOTE_PASSWORD\" ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${REMOTE_USER}@${REMOTE_SERVER} \"/usr/bin/sudo systemctl start home-api-node\""
when: on_success
only:
- master
# notify_build_failure:
# stage: notify
# script:
# - "apt-get update -qq && apt-get install -y -qq curl"
# - "curl -X POST -d 'message=\"build failed\"' https://${HOME_API_USER}:${HOME_API_AUTHKEY}@michaelhollister.me/api/pushover"
# when: on_failure
# notify_build_success:
# stage: notify
# script:
# - "apt-get update -qq && apt-get install -y -qq curl"
# - "curl -X POST -d 'message=\"build successful\"' https://${HOME_API_USER}:${HOME_API_AUTHKEY}@michaelhollister.me/api/pushover"
# when: on_success