-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
56 lines (51 loc) · 1.5 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
default:
image: registry.gitlab.com/moriarty5/ieltswizard:latest
services:
- postgres
variables:
POSTGRES_DB: databasename
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_HOST_AUTH_METHOD: trust
stages:
- test
- deploy
- deploy_dev
unit_test:
stage: test
script:
- cp "$DEPLOY_ENV" $PWD/.env;
- composer install
- php artisan key:generate
- php artisan migrate --database=deploy --force
- vendor/bin/phpunit
deploy_production:
stage: deploy
script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- 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'
- ~/.composer/vendor/bin/envoy run deploy --commit="$CI_COMMIT_SHA"
environment:
name: production
url: https://ieltswizard.pro
when: manual
rules:
- if: $CI_COMMIT_BRANCH == "main"
deploy_development:
stage: deploy_dev
script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- 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'
- ~/.composer/vendor/bin/envoy run deploy_dev --commit="$CI_COMMIT_SHA"
environment:
name: development
url: https://dev.ieltswizard.pro
when: on_success
rules:
- if: $CI_COMMIT_BRANCH == "dev"