-
Notifications
You must be signed in to change notification settings - Fork 1
/
.gitlab-ci.yml
56 lines (49 loc) · 1.41 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
54
55
56
image: "registry.gitlab.com/votelog/build-image-server:latest"
services:
- name: registry.gitlab.com/votelog/testing-image-server:latest
alias: postgres
variables:
SBT_VERSION: "1.5.5"
SBT_OPTS: "-Dsbt.global.base=cache/.sbtglobal -Dsbt.boot.directory=cache/.sbtboot -Dsbt.ivy.home=cache/.ivy"
COURSIER_CACHE: "cache/coursier/v1"
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: raclette
VOTELOG_DATABASE_URL: jdbc:postgresql://postgres:5432/postgres
FF_NETWORK_PER_BUILD: "true"
cache:
key: "$CI_BUILD_REF_NAME" # contains either the branch or the tag, so it's caching per branch
untracked: true
paths:
- "cache/.sbtglobal"
- "cache/.sbtboot"
- "cache/coursier/v1"
- "cache/.ivy"
- "target"
- "webserver/target"
- "webclient/target"
stages:
- build
- deploy
build:
stage: build
script:
- sbt "compile; test; it:test"
deploy-backend:
stage: deploy
only:
- master
before_script:
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
script:
- sbt stage
- rsync -az --delete-after webserver/target/universal/stage/ [email protected]:~/bin/votelog-server
- |-
ssh [email protected]<<EOF
systemctl --user restart votelog-server.service
EOF