-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
89 lines (82 loc) · 3.11 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
88
89
services:
before_script:
- php -v
after_script:
- if [ -f var/log/*.log ]; then cat var/log/*.log; fi
stages:
- build
- deploy
variables:
#CI_DEBUG_TRACE: "true"
job1:
stage: build
script:
- pwd
- composer install
- composer require --dev roave/security-advisories:dev-master
- docker/docker.sh private:travis:before_script
- cp app/config/config.local.dist.neon app/config/config.local.neon
- rm -rf var/tempcli/cache
- redis-cli -h localhost -n 1 flushdb
# - development=true php app/console orm:schema-tool:drop --force
# - development=true php app/console orm:schema-tool:update --force
- docker/docker.sh private:test-coding-style
- echo "job1 succesfully completed!"
tags:
- citicash
staging:
stage: deploy
before_script:
- echo "Deploy to staging server"
- mkdir -p ~/.ssh
- echo -e "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
script:
- composer install --prefer-dist --no-dev
- rsync -rvvazhP --delete --filter="merge .rsync-filter.conf" ./ ${SSH_DEV_SERVER}:/var/www/blockchain-explorer
- ssh ${SSH_DEV_SERVER} "cd /var/www/blockchain-explorer/ &&
sudo rm -rf var/temp/cache/ var/tempcli/cache/ &&
composer install --prefer-dist --no-dev &&
composer dump-autoload --optimize --no-dev &&
redis-cli -h ${SSH_DEV_REDIS_SERVER} -n 1 flushdb"
- echo "deploy to staging succesfully completed!"
- curl --request POST --header 'Content-Type:application/json' --data "{\"icon_emoji\":\":avocado:\",\"text\":\"new realease DEV https://blockchain-explorer.citicash.loc, hash ${CI_COMMIT_SHA}, message ${CI_COMMIT_TITLE}\"}" ${WEBHOOK_URL}
environment:
name: staging
url: https://blockchain-explorer.citicash.loc
only:
- master
tags:
- citicash
production:
stage: deploy
before_script:
- echo "Deploy to production server!"
- mkdir -p ~/.ssh
- echo -e "$SSH_PRODUCTION_PRIVATE_KEY" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
script:
- composer install --prefer-dist --no-dev
- rsync -rvvazhP --delete --filter="merge .rsync-filter.conf" ./ ${SSH_PRODUCTION_SERVER}:/var/www/blockchain-explorer
- ssh ${SSH_PRODUCTION_SERVER} "cd /var/www/blockchain-explorer/ &&
sudo rm -rf var/temp/cache/ var/tempcli/cache/ &&
composer install --prefer-dist --no-dev &&
composer dump-autoload --optimize --no-dev &&
redis-cli -h ${SSH_PRODUCTION_REDIS_SERVER} -n 1 flushdb"
- echo "deploy to production succesfully completed!"
- curl --request POST --header 'Content-Type:application/json' --data "{\"icon_emoji\":\":avocado:\",\"text\":\"new realease PRODUCTION https://blockchain-explorer.citicash.io, hash ${CI_COMMIT_SHA}, message ${CI_COMMIT_TITLE}\"}" ${WEBHOOK_URL}
environment:
name: production
url: https://blockchain-explorer.citicash.io
when: manual
only:
- master
tags:
- live
# Cache libraries in between jobs
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- vendor/