forked from go-training/drone-nodejs-example
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.drone.yml
141 lines (129 loc) · 3.07 KB
/
.drone.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
pipeline:
restore-cache:
image: drillster/drone-volume-cache
restore: true
mount:
- ./.yarn-cache
- ./node_modules
volumes:
- /tmp/cache:/cache
install:
image: node:8.6.0
commands:
- node -v
- npm -v
- yarn --version
- yarn config set cache-folder .yarn-cache
- yarn install --pure-lockfile
testing:
image: node:8.6.0
group: testing
commands:
- yarn run test
lint:
image: node:8.6.0
group: testing
commands:
- yarn run lint
publish:
image: plugins/docker
repo: appleboy/k8s-node-demo
dockerfile: Dockerfile
secrets:
- source: demo_username
target: docker_username
- source: demo_password
target: docker_password
tags: [ latest, '${DRONE_TAG}' ]
when:
event: tag
deploy:
image: quay.io/honestbee/drone-kubernetes
namespace: demo
deployment: k8s-node-demo
repo: appleboy/k8s-node-demo
container: k8s-node-demo
tag: ${DRONE_TAG}
secrets:
- source: drone_ssh_key
target: ssh_key
- source: k8s_cert
target: plugin_kubernetes_cert
- source: k8s_token
target: plugin_kubernetes_token
when:
event: tag
golang:
image: harbor.wu-boy.com/test/golang:1.9.0-alpine3.6
group: testing
commands:
- go version
publish:
image: plugins/docker
insecure: true
registry: harbor.wu-boy.com
repo: harbor.wu-boy.com/test/demo
dockerfile: Dockerfile
secrets: [ docker_username, docker_password ]
tags: [ latest, 1.1 ]
scp:
image: appleboy/drone-scp
host:
- 128.199.163.232
port: 22
username: root
target: /root/drone/${DRONE_REPO}
secrets: [ ssh_key ]
source:
- "*.js"
- process.json
- node_modules
- Dockerfile
when:
branch: master
ssh-1:
image: appleboy/drone-ssh
group: ssh
host:
- 128.199.163.232
port: 22
username: root
command_timeout: 120
secrets: [ ssh_key ]
script:
- . /root/.nvm/nvm.sh && nvm use 8.6.0
- rm -rf ${DRONE_REPO} && mkdir -p ${DRONE_REPO}
- cp -r drone/${DRONE_REPO}/* ${DRONE_REPO}/
- cd ${DRONE_REPO} && pm2 restart process.json
when:
branch: master
ssh-2:
image: appleboy/drone-ssh
group: ssh
host:
- 128.199.163.232
port: 22
username: root
command_timeout: 120
secrets: [ ssh_key ]
script:
- rm -rf docker/${DRONE_REPO} && mkdir -p docker/${DRONE_REPO}
- cp -r drone/${DRONE_REPO}/* docker/${DRONE_REPO}/
- cd docker/${DRONE_REPO} && docker build -t appleboy/node . && docker rm -f app && docker run -d --name app -p 8081:8080 appleboy/node
when:
branch: master
discord:
image: appleboy/drone-discord
secrets: [ discord_webhook_id, discord_webhook_token ]
when:
status: [ success, failure ]
rebuild-cache:
image: drillster/drone-volume-cache
rebuild: true
mount:
- ./.yarn-cache
- ./node_modules
volumes:
- /tmp/cache:/cache
when:
branch: master