Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/depoly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy Backend to VPS

# Run on push to the main branch
on:
push:
branches:
- ${{ secrets.SERVER_BRANCH }}

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: SSH into server and deploy backend
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_SSH_KEY }}
script: |
echo "--- Starting Backend Deployment ---"
cd /var/www/backend
echo "Pulling backend changes..."
git pull origin ${{ secrets.SERVER_BRANCH }}
echo "Installing backend dependencies..."
npm install
echo "Restarting backend app..."
pm2 restart backend-app
echo "--- Backend Deployment Complete ---"