Skip to content

chore(fix): add new github actions #2

chore(fix): add new github actions

chore(fix): add new github actions #2

Workflow file for this run

name: Auto Deploy in VPS after Push in Production
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy Django project
permissions:
deployments: write
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: 'actions/checkout@v2'
with:
ref: main
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
- name: Set up SSH Key and Deploy Django project
uses: appleboy/ssh-action@master
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
with:
host: ${{ secrets.VPS_IP }}
username: ${{ secrets.VPS_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
port: 22
script: |
cd /var/www/2077-CMS/
git pull origin main
python manage.py migrate
python manage.py collectstatic --no-input
sudo systemctl restart gunicorn
sudo systemctl restart nginx