forked from maingocthanhtan96/LaraJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci_tmp.yml
62 lines (55 loc) · 1.85 KB
/
.gitlab-ci_tmp.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
image: registry.gitlab.com/ot6/avatarr:latest
#services:
# - mysql:5.7
# Helper function to setup private key to ssh to server
.init_opensshclient: &init_opensshclient |
eval $(ssh-agent -s)
ssh-add <(echo "$SSH_PRIVATE_KEY")
mkdir -p ~/.ssh
'[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
variables:
MYSQL_DATABASE: homestead
MYSQL_ROOT_PASSWORD: secret
DB_HOST: mysql
DB_USERNAME: root
stages:
- test
- dev
- staging
unit_test:
stage: test
script:
- cp .env.example .env
# - composer install --ignore-platform-reqs --no-dev --optimize-autoloader --no-ansi --no-interaction --no-progress
# - php artisan key:generate
# - php artisan migrate
# - vendor/bin/phpunit
deploy_dev:
stage: dev
script:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" > /tmp/id_rsa && chmod 400 /tmp/id_rsa && ssh-add /tmp/id_rsa && mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- composer global require --prefer-dist laravel/envoy=~2.0 --no-interaction --prefer-dist --quiet
- /tmp/vendor/bin/envoy run deploy --commit="$CI_COMMIT_SHA" --branch=dev
environment:
name: DEV
url: https://dev.avatarr.io
when: on_success
only:
- dev
deploy_staging:
image: composer:latest
stage: staging
script:
- eval $(ssh-agent -s)
- echo "$SSH_PRIVATE_KEY" > /tmp/id_rsa && chmod 400 /tmp/id_rsa && ssh-add /tmp/id_rsa && mkdir -p ~/.ssh
- '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config'
- composer global require --prefer-dist laravel/envoy=~2.0 --no-interaction --prefer-dist --quiet
- /tmp/vendor/bin/envoy run deploy --commit="$CI_COMMIT_SHA" --branch=uat
environment:
name: STAGING
url: https://uat.avatarr.io
when: on_success
only:
- uat