-
Notifications
You must be signed in to change notification settings - Fork 17
/
.gitlab-ci.yml
53 lines (50 loc) · 1.56 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
43
44
45
46
47
48
49
50
51
52
53
stages:
- build
- deploy
build:
stage: build
image: registry.offline.swiss/internals/docker/website-gulp-build:latest
only:
- master
artifacts:
expire_in: '10 minutes'
untracked: true
script:
- cd themes/*
- ln -s /tmp/gulp/node_modules ./node_modules
- gulp --production
optimize:
stage: build
image: registry.offline.swiss/internals/docker/website-optimizer:latest
only:
- master
artifacts:
expire_in: '10 minutes'
paths:
- themes/*
script:
- optipng themes/*/assets/*.png
- jpegoptim themes/*/assets/*.{jpg,jpeg}
- count=$(ls -1 themes/*/assets/*.svg 2>/dev/null | wc -l) || true
- if [ $count != 0 ]; then svgo --disable=removeViewBox themes/*/assets/*.svg; fi
deploy:
image: registry.offline.swiss/internals/docker/envoy:latest
stage: deploy
only:
- master
dependencies:
- build
- optimize
script:
- eval $(ssh-agent -s)
- echo "$SSH_DEPLOY_KEY" > /tmp/id_rsa && chmod 400 /tmp/id_rsa && ssh-add /tmp/id_rsa && mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- |
envoy run deploy \
--author="$GITLAB_USER_LOGIN" \
--branch="$CI_COMMIT_REF_NAME" \
--commit="$CI_COMMIT_MESSAGE" \
--slack="$SLACK_URL" \
--user="$USER" \
--server="$SERVER" \
--directory="$DIRECTORY"