This repository has been archived by the owner on Dec 1, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy path.drone.yml
211 lines (194 loc) · 5.51 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
---
kind: pipeline
name: Test
type: docker
steps:
- name: lint
image: node:buster
volumes:
- name: node_modules
path: /usr/local/lib/node_modules
commands:
- npm install -g stylelint stylelint-config-standard jslint
- npx stylelint "themes/crisp/css/*.css"
- jslint "themes/crisp/js/!(*.min).js"
- name: create_postgres_db
image: postgres:9-alpine
commands:
- psql -h postgres -U postgres -c "CREATE DATABASE tosdr_dev;"
- name: create_crisp_config
image: alpine
commands:
- echo -e "MYSQL_HOSTNAME=postgres\n" > .env
- echo -e "MYSQL_USERNAME=postgres\n" >> .env
- echo -e "MYSQL_PASSWORD=postgres\n" >> .env
- echo -e "MYSQL_DATABASE=tosdr_dev\n" >> .env
- echo -e "REDIS_HOST=redis\n" >> .env
- echo -e "REDIS_PORT=6379\n" >> .env
- name: migrate_crisp_lint
image: php:8.0-buster
environment:
COMPOSER_ALLOW_SUPERUSER: 1
commands:
- mkdir /tmp/ci
- cd /tmp/ci
- apt-get update && apt-get install -y libpq-dev autoconf gcc libc6-dev make libicu-dev wget git-core zip zlib1g-dev libpng-dev
- pecl install redis-5.3.2
- docker-php-ext-install pgsql pdo_pgsql pdo_mysql intl gd gettext
- docker-php-ext-enable pdo_pgsql pdo_mysql redis intl gd gettext
- wget https://getcomposer.org/composer-stable.phar -O /tmp/ci/composer
- cd /drone/src
- php /tmp/ci/composer install
- php bin/cli.php migrate
- php bin/cli.php theme install crisp
# - vendor/bin/twig-linter lint themes/crisp/templates/
# - vendor/bin/phpunit tests --bootstrap tosdr/crisp.php
- rm /tmp/ci/composer
- name: Zip Production
image: node:alpine
commands:
- apk --no-cache add zip bash
- mkdir dist
- zip -r dist/build.zip ./ -x '*.git*' -x 'tosdr/cache' -x '.env' -x 'static' -x '.vscode' -x 'dist' -x 'nbproject'
when:
branch:
- master
event:
- push
- name: Upload Build Artifacts
image: plugins/s3
settings:
bucket: tosdr-artifacts
source: ./dist/*
strip_prefix: true
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
target: /CrispCMS/builds/${DRONE_BUILD_NUMBER}
endpoint: https://s3.eu-west-2.jbcdn.net
when:
branch:
- master
event:
- push
volumes:
- name: bundle
temp: {}
- name: phoenix
temp: {}
- name: node_modules
temp: {}
services:
- name: redis
image: redis
- name: postgres
image: postgres
environment:
POSTGRES_USER: postgres
POSTGRES_DB: postgres
POSTGRES_HOST_AUTH_METHOD: trust
---
kind: pipeline
type: docker
name: Deploy
steps:
- name: Deploy Production
image: appleboy/drone-ssh
settings:
host:
from_secret: SSH_HOST
username:
from_secret: SSH_USER
key:
from_secret: SSH_KEY
port: 22
script:
- cd /usr/share/tosdr/web
- /usr/bin/php bin/cli.php maintenance on
- /usr/bin/git fetch origin master
- /usr/bin/git reset --hard HEAD
- /usr/bin/git merge ${DRONE_COMMIT_SHA}
- /usr/local/bin/composer update
- /usr/local/bin/composer install
- /usr/bin/php bin/cli.php migrate
- /usr/bin/php bin/cli.php theme storage refresh crisp
- /usr/bin/php bin/cli.php theme translations refresh crisp
- /usr/bin/php bin/cli.php plugin storage refresh management
- /usr/bin/php bin/cli.php plugin translations refresh management
- /usr/bin/php bin/cli.php cache clear
- /usr/bin/php bin/cli.php maintenance off
when:
target:
include:
- staging
- production
- name: Deploy Staging
image: appleboy/drone-ssh
settings:
host:
from_secret: SSH_HOST
username:
from_secret: SSH_USER
key:
from_secret: SSH_KEY
port: 22
script:
- cd /usr/share/tosdr/staging
- /usr/bin/php bin/cli.php maintenance on
- /usr/bin/git fetch origin master
- /usr/bin/git reset --hard HEAD
- /usr/bin/git merge ${DRONE_COMMIT_SHA}
- /usr/local/bin/composer update
- /usr/local/bin/composer install
- /usr/bin/php bin/cli.php migrate
- /usr/bin/php bin/cli.php theme storage refresh crisp
- /usr/bin/php bin/cli.php theme translations refresh crisp
- /usr/bin/php bin/cli.php plugin storage refresh management
- /usr/bin/php bin/cli.php plugin translations refresh management
- /usr/bin/php bin/cli.php cache clear
- /usr/bin/php bin/cli.php maintenance off
when:
target:
include:
- staging
- name: Jira Production
image: plugins/jira
settings:
client_id:
from_secret: jira_client_id
client_secret:
from_secret: jira_client_secret
project: CRISP
instance: tosdr
environment: production
when:
target:
include:
- production
- name: Jira Staging
image: plugins/jira
settings:
client_id:
from_secret: jira_client_id
client_secret:
from_secret: jira_client_secret
project: CRISP
instance: tosdr
environment: staging
when:
target:
include:
- staging
trigger:
branch:
- master
event:
include:
- promote
depends_on:
- Test
---
kind: signature
hmac: 4f211cc052785f20d2beb2c5b77e9b8839b239cd84b91b016c2a9ca9997bfaad
...