Merge pull request #123 from Delta-Docs/deployment/cicd #11
This file contains hidden or 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 to VPS | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Deploy via SSH | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.VPS_IP }} | |
| username: ${{ secrets.VPS_USERNAME }} | |
| key: ${{ secrets.VPS_SSH_KEY }} | |
| script: | | |
| # 1. Enter the project folder | |
| cd delta.backend | |
| # 2. Pull the latest code | |
| git pull origin main | |
| # 3. Build and run updated containers | |
| sudo docker-compose up --build -d | |
| # 4. Migrate the DB | |
| sudo docker-compose exec -T api alembic upgrade head |