-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.drone.yml
182 lines (163 loc) Β· 4.48 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
---
kind: pipeline
name: pull_request
steps:
- name: restore node_modules cache
image: lbogdan/codesandbox-cache-plugin:1
settings:
restore: true
volumes:
- name: node_modules-cache
path: /cache
- name: install packages
image: node:10.22.1-buster
volumes:
- name: yarn-cache
path: /usr/local/share/.cache/yarn/v4
commands:
- yarn
- name: build
image: node:10.22.1-buster
commands:
- export STAGING_BRANCH=pr$DRONE_PULL_REQUEST
- yarn build
- name: deploy
image: lbogdan/codesandbox-deploy-plugin:4
settings:
domain: &domain build.csb.dev
volumes:
- name: docker_sock
path: /var/run/docker.sock
- name: deployments
path: /root/docker/deployments
- name: create github deployment
image: lbogdan/github-deployment-plugin:1
settings:
domain: *domain
github_token:
from_secret: github_token
- name: slack notification
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
channel: infra
template: >
{{#success build.status}}
π {{repo.owner}}/{{repo.name}} pull request #{{build.pull}} successfully built. Access it at https://pr{{build.pull}}.build.csb.dev/ and see the build logs <{{build.link}}|here>.
{{else}}
π {{repo.owner}}/{{repo.name}} pull request #{{build.pull}} building failed. See what happened <{{build.link}}|here>.
{{/success}}
when:
status:
- success
- failure
- name: github comment
image: lbogdan/github-comment-plugin:1
settings:
domain: *domain
github_token:
from_secret: github_token
template: |
Build for latest commit https://github.com/{{owner}}/{{repo}}/pull/{{pr}}/commits/{{commitSha}} {{#success}}is at https://pr{{pr}}.{{buildDomain}}/s/new{{/success}}{{^success}}failed{{/success}}.
when:
status:
- success
- failure
- name: rebuild node_modules cache
image: lbogdan/codesandbox-cache-plugin:1
settings:
rebuild: true
volumes:
- name: node_modules-cache
path: /cache
volumes:
- name: yarn-cache
host:
path: /var/lib/docker/volumes/yarn-cache/_data
- name: node_modules-cache
host:
path: /var/lib/docker/volumes/node_modules-cache/_data
- name: docker_sock
host:
path: /var/run/docker.sock
- name: deployments
host:
path: /root/docker/deployments
trigger:
event: pull_request
---
kind: pipeline
name: branch
steps:
- name: restore node_modules cache
image: lbogdan/codesandbox-cache-plugin:1
settings:
restore: true
volumes:
- name: node_modules-cache
path: /cache
- name: install packages
image: node:10.22.1-buster
volumes:
- name: yarn-cache
path: /usr/local/share/.cache/yarn/v4
commands:
- yarn
- name: build
image: node:10.22.1-buster
commands:
- export STAGING_BRANCH=$DRONE_BRANCH
- yarn build
- name: deploy
image: lbogdan/codesandbox-deploy-plugin:4
settings:
domain: &domain build.csb.dev
volumes:
- name: docker_sock
path: /var/run/docker.sock
- name: deployments
path: /root/docker/deployments
- name: slack notification
image: plugins/slack
settings:
webhook:
from_secret: slack_webhook
channel: infra
template: >
{{#success build.status}}
π {{repo.owner}}/{{repo.name}} branch {{build.branch}} successfully built. Access it at https://{{build.branch}}.build.csb.dev/ and see the build logs <{{build.link}}|here>.
{{else}}
π {{repo.owner}}/{{repo.name}} branch {{build.branch}} building failed. See what happened <{{build.link}}|here>.
{{/success}}
when:
status:
- success
- failure
- name: rebuild node_modules cache
image: lbogdan/codesandbox-cache-plugin:1
settings:
rebuild: true
volumes:
- name: node_modules-cache
path: /cache
volumes:
- name: yarn-cache
host:
path: /var/lib/docker/volumes/yarn-cache/_data
- name: node_modules-cache
host:
path: /var/lib/docker/volumes/node_modules-cache/_data
- name: docker_sock
host:
path: /var/run/docker.sock
- name: deployments
host:
path: /root/docker/deployments
trigger:
event: push
branch: master
---
kind: signature
hmac: 277acb64abeb8d7398e7366f0e1497d66376dd487bd08f6b8b13e8c1cf78579a
...