Skip to content

Commit

Permalink
chore(fix): add new github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ndu committed Aug 17, 2024
1 parent 9f40b11 commit 430b48e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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

0 comments on commit 430b48e

Please sign in to comment.