forked from Uberspace/lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
53 lines (41 loc) · 1.01 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
---
image: uberspace/ansible:2.4
variables:
DEPLOYMENT_SSH_KEY_PATH: /tmp/.deployment-ssh-key
stages:
- build
- deploy
before_script:
# GitLab inserts a \r for each newline into our private key. This confuses the ssh client.
- umask 077; echo "$SSH_KEY" | tr -d '\r' > $DEPLOYMENT_SSH_KEY_PATH
Build HTML:
stage: build
image: python:3.6
script:
- pip install --quiet -r requirements.txt
- make html
artifacts:
paths:
- build
Deploy to staging:
stage: deploy
except:
- master
script:
- ansible-playbook deploy.yml --private-key=$DEPLOYMENT_SSH_KEY_PATH
variables:
DOMAIN: $CI_BUILD_REF_SLUG.lab.uberspace.de
environment:
name: staging/$CI_BUILD_REF_SLUG
url: http://$CI_BUILD_REF_SLUG.lab.uberspace.de
Deploy to production:
stage: deploy
only:
- master
script:
- ansible-playbook deploy.yml --private-key=$DEPLOYMENT_SSH_KEY_PATH
variables:
DOMAIN: lab.uberspace.de
environment:
name: production
url: https://lab.uberspace.de