-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (46 loc) · 1.78 KB
/
delivery.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
name: Continus Delivery
on: workflow_dispatch
jobs:
deliver-main:
runs-on: self-hosted
env:
configdir: /var/www/config/caravel
rootdir: /var/www/caravel
backend: /var/www/caravel/backend
frontend: /var/www/caravel/frontend
share: /var/www/shared
steps:
- name: stop server during deployment
run: sudo service nginx stop
- name: checkout main branch
uses: actions/checkout@v2
- name: Copy configuration files
run: rsync --recursive ${{ env.configdir }}/* .
- name: Install composer Dependencies for Laravel
run: composer install -q --no-interaction --no-scripts --no-progress --prefer-dist
working-directory: ./backend
- name: Apply modifications on DB if needed for laravel
run: yes | php artisan migrate
working-directory: ./backend
- name: Copy backend Laravel
run: |
sudo rm -r ./backend/storage
sudo rsync --recursive ./backend ${{ env.rootdir }}
- name: Install dependencies frontend
run: npm install
working-directory: ./frontend
- name: Build frontend
run: npm run build
working-directory: ./frontend
- name: Copy frontend
run: sudo rsync --recursive ./frontend/dist ${{ env.frontend }}
- name: Create symlinks
run: |
sudo ln -s ${{ env.share }}/storage ${{ env.backend }} -f
sudo ln -s ${{ env.share }}/uploads ${{ env.backend }}/public -f
- name: Set global permissions
run: |
sudo chown www-data:www-data -R ${{ env.rootdir }}
sudo chmod -R 755 ${{ env.rootdir }}
- name: Restart server (last step)
run: sudo service nginx start