-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
73 lines (69 loc) · 3.94 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
image: php:8.1-cli
stages:
- deploy_new_vps
deploy_new_vps:
stage: deploy_new_vps
script:
- apt-get update -yqq
- apt-get install -yqq openssh-client
- apt-get update && apt-get install -y libssl-dev
- mkdir -p ~/.ssh
- echo "$SSH_VPS_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
- eval "$(ssh-agent -s)"
- ssh-add ~/.ssh/id_rsa
- ssh-keyscan -H $SSH_NEW_VPS_HOST >> ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- ssh -p $SSH_NEW_VPS_PORT -i ~/.ssh/id_rsa $SSH_NEW_VPS_USER@$SSH_NEW_VPS_HOST pwd
- ssh -p $SSH_NEW_VPS_PORT -i ~/.ssh/id_rsa $SSH_NEW_VPS_USER@$SSH_NEW_VPS_HOST "cd /var/www/lazarefortune && git reset --hard HEAD && git pull gitlab main"
- ssh -p $SSH_NEW_VPS_PORT -i ~/.ssh/id_rsa $SSH_NEW_VPS_USER@$SSH_NEW_VPS_HOST "cd /var/www/lazarefortune && composer install --prefer-dist --no-ansi --no-interaction --no-scripts --no-dev"
- ssh -p $SSH_NEW_VPS_PORT -i ~/.ssh/id_rsa $SSH_NEW_VPS_USER@$SSH_NEW_VPS_HOST "cd /var/www/lazarefortune && php bin/console doctrine:migrations:migrate --no-interaction"
- ssh -p $SSH_NEW_VPS_PORT -i ~/.ssh/id_rsa $SSH_NEW_VPS_USER@$SSH_NEW_VPS_HOST "cd /var/www/lazarefortune && pnpm install"
- ssh -p $SSH_NEW_VPS_PORT -i ~/.ssh/id_rsa $SSH_NEW_VPS_USER@$SSH_NEW_VPS_HOST "cd /var/www/lazarefortune && pnpm run build"
- ssh -p $SSH_NEW_VPS_PORT -i ~/.ssh/id_rsa $SSH_NEW_VPS_USER@$SSH_NEW_VPS_HOST "cd /var/www/lazarefortune && php bin/console cache:clear"
only:
- main
#deploy_vps:
# stage: deploy_vps
# script:
# - apt-get update -yqq
# - apt-get install -yqq openssh-client
# - apt-get update && apt-get install -y libssl-dev
# - mkdir -p ~/.ssh
# - echo "$SSH_VPS_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
# - chmod 600 ~/.ssh/id_rsa
# - eval "$(ssh-agent -s)"
# - ssh-add ~/.ssh/id_rsa
# - ssh-keyscan -H $SSH_VPS_HOST >> ~/.ssh/known_hosts
# - chmod 644 ~/.ssh/known_hosts
# - ssh -p $SSH_VPS_PORT -i ~/.ssh/id_rsa $SSH_VPS_USER@$SSH_VPS_HOST pwd
# - ssh -p $SSH_VPS_PORT -i ~/.ssh/id_rsa $SSH_VPS_USER@$SSH_VPS_HOST "cd /var/www/lazarefortune && git reset --hard HEAD && git pull gitlab main"
# - ssh -p $SSH_VPS_PORT -i ~/.ssh/id_rsa $SSH_VPS_USER@$SSH_VPS_HOST "cd /var/www/lazarefortune && composer install --prefer-dist --no-ansi --no-interaction --no-scripts --no-dev"
# - ssh -p $SSH_VPS_PORT -i ~/.ssh/id_rsa $SSH_VPS_USER@$SSH_VPS_HOST "cd /var/www/lazarefortune && php bin/console doctrine:migrations:migrate --no-interaction"
# - ssh -p $SSH_VPS_PORT -i ~/.ssh/id_rsa $SSH_VPS_USER@$SSH_VPS_HOST "cd /var/www/lazarefortune && pnpm install"
# - ssh -p $SSH_VPS_PORT -i ~/.ssh/id_rsa $SSH_VPS_USER@$SSH_VPS_HOST "cd /var/www/lazarefortune && pnpm run build"
# - ssh -p $SSH_VPS_PORT -i ~/.ssh/id_rsa $SSH_VPS_USER@$SSH_VPS_HOST "cd /var/www/lazarefortune && php bin/console cache:clear"
#
# only:
# - vps
#
#deploy:
# stage: deploy
# script:
# - apt-get update -yqq
# - apt-get install -yqq openssh-client
# - mkdir -p ~/.ssh
# - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
# - chmod 600 ~/.ssh/id_rsa
# - eval "$(ssh-agent -s)"
# - ssh-add ~/.ssh/id_rsa
# - ssh-keyscan -p $SSH_PORT -H $SSH_HOST >> ~/.ssh/known_hosts
# - chmod 644 ~/.ssh/known_hosts
# - ssh -p $SSH_PORT -i ~/.ssh/id_rsa $SSH_USER@$SSH_HOST pwd
# - ssh -p $SSH_PORT -i ~/.ssh/id_rsa $SSH_USER@$SSH_HOST "cd public_html/app && composer2 install --no-dev --prefer-dist --no-ansi --no-interaction --no-scripts"
# - ssh -p $SSH_PORT -i ~/.ssh/id_rsa $SSH_USER@$SSH_HOST "cd public_html/app && php bin/console doctrine:migrations:migrate --no-interaction"
# - ssh -p $SSH_PORT -i ~/.ssh/id_rsa $SSH_USER@$SSH_HOST "cd public_html/app && pnpm install"
# - ssh -p $SSH_PORT -i ~/.ssh/id_rsa $SSH_USER@$SSH_HOST "cd public_html/app && pnpm run build"
# - ssh -p $SSH_PORT -i ~/.ssh/id_rsa $SSH_USER@$SSH_HOST "cd public_html/app && php bin/console cache:clear"
# only:
# - main