-
Notifications
You must be signed in to change notification settings - Fork 10
/
.drone.yml
149 lines (134 loc) Β· 4.04 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
pipeline:
install:
image: node:10
commands:
- npm install
when:
branch:
exclude: [ production, staging, greenkeeper/* ]
build:
image: node:10
commands:
# Determine if webpack needs a rebuild.
- git fetch origin staging
- git checkout origin/staging config/webpack/build.json
- npm run toggle-webpack
- npm run build -- staging
when:
branch:
exclude: [ production, staging, rc/*, greenkeeper/* ]
sitemap:
image: node:10
commands:
npm run sitemap
secrets: [ tsm_client_id, tsm_client_secret ]
when:
branch: development
# Rebuild for production up here so we can run tests afterwards.
prepare - production:
image: node:10
commands:
- rm ui/assets/robots.txt # Allow search engines to scrape
- npm run build # Rebuild webpack without staging config
when:
branch: rc/*
# Smoke tests
lint:
image: node:10
commands:
- npm run lint
when:
branch:
exclude: [ production, staging, rc/*, greenkeeper/* ]
test - development:
image: node:10
commands:
- npm test
secrets: [ tsm_client_id, tsm_client_secret ]
when:
branch:
exclude: [ production, staging, rc/*, greenkeeper/*, development ]
test - production:
image: node:10
commands:
- npm test --production
secrets: [ tsm_client_id, tsm_client_secret ]
when:
branch:
exclude: [ production, staging, rc/*, greenkeeper/*, development ]
# Add to staging branch
push - staging:
image: node:10
commands:
- git config --global user.email "[email protected]"
- git config --global user.name "nexus-ci"
- git checkout development
- git submodule foreach --recursive git pull origin master
# Modify files as needed for staging build
- sed -i '/\\/ui\\/assets\\/bundles\\//d' .gitignore # Keep webpack builds
- mv ui/assets/.robots.txt ui/assets/robots.txt # Make search engines ignore the staging site
# Push changes from above and from dev branch
- bash ci/git/push-staging.sh
secrets: [ nexus_ci_token ]
when:
branch: development
event: [ push ]
# Push production preparations to release candidate
push - production:
image: node:10
commands:
- git config --global user.email "[email protected]"
- git config --global user.name "nexus-ci"
- git fetch origin production
- git checkout $${DRONE_BRANCH}
# Push changes to production if last commit contains "release: "
- bash ci/git/push-production.sh
secrets: [ nexus_ci_token ]
when:
branch: rc/*
event: [ push ]
# Build nexus-stats:staging image and push to dockerhub. Dockerhub will then
# trigger a webhook on the staging server to redeploy.
publish - staging:
image: plugins/docker
dockerfile: docker/app/prod/Dockerfile.staging
context: docker/app/prod/
repo: nexusstats/nexus-stats
tags: staging
no_cache: true
secrets: [ docker_username, docker_password ]
when:
branch: staging
event: [ push ]
publish - development:
image: plugins/docker
dockerfile: docker/app/dev/Dockerfile
context: docker/app/dev/
repo: nexusstats/nexus-stats-dev
no_cache: true
secrets: [ docker_username, docker_password ]
when:
branch: staging
event: [ push ]
publish - production:
image: plugins/docker
dockerfile: docker/app/prod/Dockerfile.prod
context: docker/app/prod/
repo: nexusstats/nexus-stats
no_cache: true
secrets: [ docker_username, docker_password ]
when:
branch: production
event: [ push ]
services:
mongodb:
image: mongo:4.2-bionic
pull: true
when:
branch:
exclude: [ production, staging, greenkeeper/* ]
redis:
image: redis
when:
branch:
exclude: [ production, staging, greenkeeper/* ]