Merge branch 'dev' #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
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 | |
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 |