-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
71 lines (67 loc) · 1.76 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
stages:
- build
- deploy
variables:
TARGET_DIR: "/var/www/wirvsvirus"
composer install:
only:
- master
- web
image: php:7.2
stage: build
before_script:
- apt-get update -qq -o Dpkg::Use-Pty=0
- apt-get install -qq -y -o Dpkg::Use-Pty=0 git
- curl -sS https://getcomposer.org/installer | php
script:
- ./composer.phar install --no-dev --optimize-autoloader
artifacts:
untracked: true
paths:
- vendor/
Deploy Staging:
environment:
name: Staging
url: https://api.corona-vor-ort.de
tags:
- staging-runner
only:
- master
- web
stage: deploy
dependencies:
- composer install
script:
- rm -rf $TARGET_DIR/src
- rm -rf $TARGET_DIR/vendor
- cp -a bin/ $TARGET_DIR
- cp -a config/ $TARGET_DIR
- cp -a public/ $TARGET_DIR
- cp -a res/ $TARGET_DIR
- cp -a src/ $TARGET_DIR
- cp -a templates/ $TARGET_DIR
- cp -a vendor/ $TARGET_DIR
- cp -a .env $TARGET_DIR
- cd $TARGET_DIR
- php7.2 bin/console cache:clear
- php7.2 bin/console --no-interaction doctrine:migrations:migrate
Github Mirror:
image: ubuntu
only:
- master
stage: build
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- ssh-keyscan github.com >> ~/.ssh/known_hosts
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
script:
- git remote add gitlab [email protected]:$CI_PROJECT_PATH.git
- git remote add github [email protected]:Corona-vor-Ort/corona-vor-ort-api.git
- git fetch gitlab
- git checkout -b master gitlab/master
- git push --force github master