Skip to content

Commit 5a9c937

Browse files
lbogdanCompuIves
authored andcommitted
Drone.io config: add branch (master) build. (codesandbox#2890)
1 parent 31cd74e commit 5a9c937

File tree

1 file changed

+84
-24
lines changed

1 file changed

+84
-24
lines changed

.drone.yml

Lines changed: 84 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
kind: pipeline
3-
name: default
3+
name: pull_request
44

55
steps:
66
- name: restore node_modules cache
@@ -10,9 +10,6 @@ steps:
1010
volumes:
1111
- name: node_modules-cache
1212
path: /cache
13-
when:
14-
event:
15-
- pull_request
1613

1714
- name: install packages
1815
image: node:10.16.3-jessie
@@ -21,41 +18,29 @@ steps:
2118
path: /usr/local/share/.cache/yarn/v4
2219
commands:
2320
- yarn
24-
when:
25-
event:
26-
- pull_request
2721

2822
- name: build
2923
image: node:10.16.3-jessie
3024
commands:
3125
- export STAGING_BRANCH=pr$DRONE_PULL_REQUEST
3226
- yarn build
33-
when:
34-
event:
35-
- pull_request
3627

3728
- name: deploy
38-
image: lbogdan/codesandbox-deploy-plugin:1
29+
image: lbogdan/codesandbox-deploy-plugin:2
3930
settings:
4031
domain: &domain build.csb.dev
4132
volumes:
4233
- name: docker_sock
4334
path: /var/run/docker.sock
4435
- name: deployments
4536
path: /root/docker/deployments
46-
when:
47-
event:
48-
- pull_request
4937

5038
- name: create github deployment
5139
image: lbogdan/github-deployment-plugin:1
5240
settings:
5341
domain: *domain
5442
github_token:
5543
from_secret: github_token
56-
when:
57-
event:
58-
- pull_request
5944

6045
- name: slack notification
6146
image: plugins/slack
@@ -70,8 +55,6 @@ steps:
7055
👎 {{repo.owner}}/{{repo.name}} pull request #{{build.pull}} building failed. See what happened <{{build.link}}|here>.
7156
{{/success}}
7257
when:
73-
event:
74-
- pull_request
7558
status:
7659
- success
7760
- failure
@@ -85,8 +68,6 @@ steps:
8568
template: |
8669
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}}.
8770
when:
88-
event:
89-
- pull_request
9071
status:
9172
- success
9273
- failure
@@ -98,9 +79,84 @@ steps:
9879
volumes:
9980
- name: node_modules-cache
10081
path: /cache
82+
83+
volumes:
84+
- name: yarn-cache
85+
host:
86+
path: /var/lib/docker/volumes/yarn-cache/_data
87+
- name: node_modules-cache
88+
host:
89+
path: /var/lib/docker/volumes/node_modules-cache/_data
90+
- name: docker_sock
91+
host:
92+
path: /var/run/docker.sock
93+
- name: deployments
94+
host:
95+
path: /root/docker/deployments
96+
97+
trigger:
98+
event: pull_request
99+
---
100+
kind: pipeline
101+
name: branch
102+
103+
steps:
104+
- name: restore node_modules cache
105+
image: lbogdan/codesandbox-cache-plugin:1
106+
settings:
107+
restore: true
108+
volumes:
109+
- name: node_modules-cache
110+
path: /cache
111+
112+
- name: install packages
113+
image: node:10.16.3-jessie
114+
volumes:
115+
- name: yarn-cache
116+
path: /usr/local/share/.cache/yarn/v4
117+
commands:
118+
- yarn
119+
120+
- name: build
121+
image: node:10.16.3-jessie
122+
commands:
123+
- export STAGING_BRANCH=$DRONE_BRANCH
124+
- yarn build
125+
126+
- name: deploy
127+
image: lbogdan/codesandbox-deploy-plugin:2
128+
settings:
129+
domain: &domain build.csb.dev
130+
volumes:
131+
- name: docker_sock
132+
path: /var/run/docker.sock
133+
- name: deployments
134+
path: /root/docker/deployments
135+
136+
- name: slack notification
137+
image: plugins/slack
138+
settings:
139+
webhook:
140+
from_secret: slack_webhook
141+
channel: infra
142+
template: >
143+
{{#success build.status}}
144+
👍 {{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>.
145+
{{else}}
146+
👎 {{repo.owner}}/{{repo.name}} branch {{build.branch}} building failed. See what happened <{{build.link}}|here>.
147+
{{/success}}
101148
when:
102-
event:
103-
- pull_request
149+
status:
150+
- success
151+
- failure
152+
153+
- name: rebuild node_modules cache
154+
image: lbogdan/codesandbox-cache-plugin:1
155+
settings:
156+
rebuild: true
157+
volumes:
158+
- name: node_modules-cache
159+
path: /cache
104160

105161
volumes:
106162
- name: yarn-cache
@@ -115,8 +171,12 @@ volumes:
115171
- name: deployments
116172
host:
117173
path: /root/docker/deployments
174+
175+
trigger:
176+
event: push
177+
branch: master
118178
---
119179
kind: signature
120-
hmac: c3f983c3f9243b3da5fd33f2d22435338c96486e27d5fb569455c05e55353a51
180+
hmac: 015a8ddaa2fa145808e3c30ad05da71d03e3b8653b6bddb41547f13611397070
121181

122182
...

0 commit comments

Comments
 (0)