starting year can be 2025 #20
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 API | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Check out the code | |
- uses: actions/checkout@v3 | |
# Step 2: Deploy to remote server | |
- name: Deploy to remote server | |
uses: easingthemes/ssh-deploy@v5.1.0 | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
REMOTE_HOST: ${{ secrets.REMOTE_HOST }} | |
REMOTE_USER: ${{ secrets.REMOTE_USER }} | |
TARGET: "/home/django/50v-backend" | |
EXCLUDE: "db.sqlite3, /.git/, /.github/" | |
with: | |
SCRIPT_AFTER: | | |
cd /home/django/50v-backend | |
python -m venv .venv | |
source .venv/bin/activate | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
python manage.py migrate | |
chown -R django:django /home/django/50v-backend | |
sudo systemctl restart gunicorn | |