-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
87 lines (80 loc) · 2.03 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
image: node:latest
cache:
key: "radar20.3"
untracked: true
policy: pull-push
paths:
- node_modules/
- .cache/
- public/
stages:
- build
- deploy
- certs
build:
stage: build
image: node:latest
artifacts:
expire_in: 1 week
paths:
- public
before_script:
- yarn install --silent
script:
- ./node_modules/.bin/gatsby build --prefix-paths
only:
- tags
- triggers
- web
except:
- schedules
pages:
stage: deploy
image: node:latest
script:
- ls
artifacts:
paths:
- public
only:
- tags
- triggers
- web
except:
- schedules
certs:
stage: certs
image: ubuntu:latest
only:
- schedules
variables:
DOMAIN: radar.niels-langlotz.com
GITLAB_URL: https://www.halle-development.com
PROJECT_ID: 404
CERT_FILE: /root/.acme.sh/$DOMAIN/fullchain.cer
KEY_FILE: /root/.acme.sh/$DOMAIN/$DOMAIN.key
script:
- sudo /root/.acme.sh/acme.sh --issue --accountconf /root/.acme.sh/account.conf --dns dns_hetzner -d $DOMAIN --force
- sleep 10
- sudo curl --silent --fail --show-error -X PUT --header "Private-Token:$GITLABAPI_TOKEN" --form "certificate=@$CERT_FILE" --form "key=@$KEY_FILE" $GITLAB_URL/api/v4/projects/$PROJECT_ID/pages/domains/$DOMAIN > /dev/null
- sleep 15
# deploy_production:
# stage: deploy
# image: ubuntu:latest
# before_script:
# - apt-get update -yq
# - apt-get install -y rsync
# - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
# - mkdir -p ~/.ssh
# - eval $(ssh-agent -s)
# - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
# script:
# - mkdir .ssh
# - echo "$PRODUCTION_PRIVATE_KEY" | base64 --decode > .ssh/id_rsa
# - chown 644 .ssh/id_rsa
# - rsync -avz -e "ssh -i .ssh/id_rsa -p $PRODUCTION_PORT -o StrictHostKeyChecking=no" --progress dist/* $PRODUCTION_USER@$PRODUCTION_HOST:$PRODUCTION_PATH/
# environment:
# name: production
# url: https://radar.typoniels.de/
# only:
# - master