Skip to content

[chore]: try to auto deploy #2

[chore]: try to auto deploy

[chore]: try to auto deploy #2

Workflow file for this run

name: Deploy FastAPI Backend
on:
push:
pull_request:
branches:
- main
- dev
jobs:
deploy:
name: Deploy to Server
runs-on: ubuntu22.04
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SERVER_SSH_KEY }}
- name: Sync Code to Server
run: |
rsync -avz --delete \
--exclude '.git' \
--exclude '.github' \
./ \
${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:${{ secrets.REMOTE_PATH }}
- name: Build and Restart Docker on Server
run: |
ssh ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }} << 'EOF'
cd ${{ secrets.REMOTE_PATH }}
cd ..
docker-compose down
docker-compose build
docker-compose up -d
EOF