Merge pull request #72 from theImmortalCoders/dev #9
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 | |
on: | |
push: | |
branches: [ "main" ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.REMOTE_HOST }} | |
username: ${{ secrets.REMOTE_USER }} | |
port: ${{ secrets.REMOTE_PORT }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd /home/project/rag-2-backend/rag-2-backend | |
git checkout main | |
git pull || { echo "Error: git pull failed" >&2; exit 1; } | |
cd /home/project | |
docker compose up --build -d | |
echo "$(date): backend deployed successfully" >> deploy-log.txt | |
docker system prune -f |