This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
config-1.0.0.yml
212 lines (190 loc) · 4.85 KB
/
config-1.0.0.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
212
version: 2.1
references:
default: &default
circleci_ip_ranges: true
working_directory: ~/theme
docker:
- image: cimg/php:7.3-node
# Rsync install
rsync_install: &rsync_install
run:
name: Install rsync
command: |
sudo apt-get update -y
sudo apt-get -y install rsync
# NPM
npm_restore_cache: &npm_restore_cache
restore_cache:
keys:
- node-v4-{{ checksum "package.json" }}
- node-v4-
npm_save_cache: &npm_save_cache
save_cache:
key: node-v4-{{ checksum "package.json" }}
paths:
- node_modules
npm_install: &npm_install
run:
name: Install NPM packages
command: |
npm install --silent
npm rebuild node-sass
# Composer
composer_restore_cache: &composer_restore_cache
restore_cache:
keys:
- v1-dependencies-{{ checksum "composer.lock" }}
- v1-dependencies-
composer_save_cache: &composer_save_cache
save_cache:
key: composer-v1-{{ checksum "composer.lock" }}
paths:
- vendor
composer_packagist: &composer_packagist
run:
name: Setup packagist authentication
command: composer config --global --auth http-basic.repo.packagist.com jstreuper $PACKAGIST_TOKEN
composer_install: &composer_install
run:
name: Compile vendors from composer packages
command: composer install -n --ignore-platform-reqs --optimize-autoloader --no-dev
# Linters
jslint: &jslint
run:
name: Lint JavaScript files
command: npx gulp jsLint
sasslint: &sasslint
run:
name: Lint SASS files
command: npx gulp sassLint
# Gulp builds
gulp_build_staging: &gulp_build_staging
run:
name: Build staging assets
command: npx gulp build
gulp_build_production: &gulp_build_production
run:
name: Build production assets
command: npx gulp buildProduction
commands:
# SSH Server keys
add_serverkey:
description: Add SSH keys for server
parameters:
server_ip:
type: string
default: ""
steps:
- run:
name: Add server keys
command: |
ssh-keyscan <<parameters.server_ip>> >> ~/.ssh/known_hosts
# rsync deploy
rsync_deploy:
description: Rsync deploy to input path
parameters:
jobname:
type: string
default: "production"
path:
type: string
default: ""
server_ip:
type: string
default: ""
steps:
- run:
name: Rsync deploy to <<parameters.jobname>>
command: |
if [ -z <<parameters.path>> ]
then
echo "No path specified to deploy to"
exit 1
fi
rsync -avz -e "ssh -p $SERVER_PORT -o StrictHostKeyChecking=no" --chown=$USER:$USER --exclude-from '.rsyncignore' . $USER@<<parameters.server_ip>>:/home/$USER/domains/<<parameters.path>>
jobs:
jslint:
<<: *default
steps:
- checkout
- << : *npm_restore_cache
- << : *npm_install
- << : *npm_save_cache
- << : *jslint
sasslint:
<<: *default
steps:
- checkout
- << : *npm_restore_cache
- << : *npm_install
- << : *npm_save_cache
- << : *sasslint
staging:
<<: *default
steps:
- checkout
- <<: *rsync_install
- <<: *npm_restore_cache
- <<: *npm_install
- <<: *npm_save_cache
- <<: *gulp_build_staging
- <<: *composer_restore_cache
- <<: *composer_packagist
- <<: *composer_install
- <<: *composer_save_cache
- add_serverkey:
server_ip: $SERVER_IP
- rsync_deploy:
jobname: "staging"
path: $STAGING_PATH
server_ip: $SERVER_IP
production:
<<: *default
steps:
- checkout
- <<: *rsync_install
- <<: *npm_restore_cache
- <<: *npm_install
- <<: *npm_save_cache
- <<: *gulp_build_production
- <<: *composer_restore_cache
- <<: *composer_packagist
- <<: *composer_install
- <<: *composer_save_cache
- add_serverkey:
server_ip: $SERVER_IP
- rsync_deploy:
jobname: "production"
path: $PRODUCTION_PATH
server_ip: $SERVER_IP
workflows:
lint:
jobs:
- jslint:
filters:
branches:
ignore:
- staging
- production
- sasslint:
filters:
branches:
ignore:
- staging
- production
deploy:
jobs:
- staging:
context:
- buro-voor-de-boeg
filters:
branches:
only:
- staging
- production:
context:
- buro-voor-de-boeg
filters:
branches:
only:
- production