-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (53 loc) · 1.51 KB
/
main.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
name: Deploy Django + Vue.js
on:
push:
branches:
- main
jobs:
Update_Code:
runs-on: self-hosted
steps:
- name: Checkout or update code
run: |
cd /home/django/project
if [ -d "./app" ]; then
cd app
git pull origin main
else
git clone https://github.com/HE-Arc/Mind-vs-Wild.git app
fi
echo "Code updated successfully."
Deploy_Django:
runs-on: self-hosted
needs: Update_Code
steps:
- name: Deploy Django backend
run: |
cd /home/django/project/app/api
export PIPENV_VENV_IN_PROJECT=1
export PIPENV_IGNORE_VIRTUALENVS=1
pipenv --rm || true
pipenv --python $(which python3)
pipenv install --deploy --ignore-pipfile
pipenv run python manage.py migrate --noinput
pipenv run python manage.py collectstatic --noinput
echo "Django backend deployed successfully."
Deploy_Frontend:
runs-on: self-hosted
needs: Update_Code
steps:
- name: Deploy Quasar frontend
run: |
cd /home/django/project/app/frontend
npm i
npm run build
echo "Frontend built successfully."
Restart_Services:
runs-on: self-hosted
needs: [Deploy_Django, Deploy_Frontend]
steps:
- name: Restart Gunicorn and Nginx
run: |
sudo systemctl restart gunicorn
sudo systemctl restart nginx
echo "Services restarted successfully."