-
Notifications
You must be signed in to change notification settings - Fork 3
36 lines (34 loc) · 1 KB
/
deploy.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
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