-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
42 lines (37 loc) · 1.24 KB
/
.gitlab-ci.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
image: elivz/php
variables:
LIVE_SSH_USER: REPLACE_ME
LIVE_DOMAIN: REPLACE_ME
LIVE_ROOT: /var/www/public_html
STAGING_SSH_USER: REPLACE_ME
STAGING_DOMAIN: REPLACE_ME
STAGING_ROOT: /var/www/staging_html
CACHE_CLEAR_URI: /actions/cacheClear/clear?key=REPLACE_ME
cache:
paths:
- node_modules
before_script:
- mkdir -p ~/.ssh
- eval $(ssh-agent -s)
- ssh-add <(echo "$SSH_PRIVATE_KEY")
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- yarn --non-interactive --silent --frozen-lockfile
- yarn build
- composer install --no-interaction --no-dev --prefer-dist --no-progress
stage_deploy:
stage: deploy
only:
- develop
artifacts:
paths:
- build/
script:
- rsync -chaz --stats --delete --exclude 'cms/storage' --exclude 'public_html/media' --exclude '.env.php' ./dist/* ${STAGING_SSH_USER}@${STAGING_DOMAIN}:${STAGING_ROOT}
- wget -qO- http://${STAGING_DOMAIN}${CACHE_CLEAR_URI}
live_deploy:
stage: deploy
only:
- master
script:
- rsync -chaz --stats --delete --exclude 'cms/storage' --exclude 'public_html/media' --exclude '.env.php' ./dist/* ${LIVE_SSH_USER}@${LIVE_DOMAIN}:${LIVE_ROOT}
- wget -qO- http://${LIVE_DOMAIN}${CACHE_CLEAR_URI}