-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
50 lines (44 loc) · 1.33 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
stages:
- test
- deploy
services:
- postgres:9.5
variables:
POSTGRES_USER: zotonic
test:
stage: test
image: driebit/ginger:latest
before_script:
- apk add --no-cache $BUILD_APKS
- ln -s $CI_PROJECT_DIR /opt/ginger/sites/
- cd /opt/zotonic
- DEBUG=1 make
script: /opt/zotonic/bin/zotonic sitetest $CI_PROJECT_NAME
.deploy_template: &deploy_template
stage: deploy
script:
- apk add --no-cache openssh-client rsync
- eval $(ssh-agent -s)
- echo "$DEPLOY_PRIVATE_KEY" | ssh-add -
- mkdir -p ~/.ssh
- echo "$DEPLOY_PUBLIC_KEYS" > ~/.ssh/known_hosts
- rsync -Pav --delete --exclude files/ --exclude config.d/ . zotonic@${ZOTONIC_HOST}:/srv/zotonic/sites/${CI_PROJECT_NAME}
- ssh zotonic@${ZOTONIC_HOST} "zotonic rpc 'schema reset [${CI_PROJECT_NAME}]'"
deploy_test:
<<: *deploy_template
environment:
name: test
url: "https://${CI_PROJECT_NAME}.ginger-test.driebit.net"
variables:
ZOTONIC_HOST: ginger-test.driebit.net
only:
- master
deploy_acc:
<<: *deploy_template
environment:
name: acceptance
url: "https://${CI_PROJECT_NAME}.ginger-acceptatie.driebit.net"
variables:
ZOTONIC_HOST: ginger-acceptatie.driebit.net
only:
- acceptance