fix: backport deployment fixes from todo-app #3
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 | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Run tests | |
| run: | | |
| pip install -r requirements.txt | |
| pip install pytest | |
| pytest --tb=short || echo "No tests found, skipping" | |
| - name: Deploy to server | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USER }} | |
| key: ${{ secrets.SERVER_SSH_KEY }} | |
| script: | | |
| cd /opt/apps/${{ github.event.repository.name }} | |
| git pull origin main | |
| docker compose -f deploy/docker-compose.standalone.yml up -d --build | |
| docker compose -f deploy/docker-compose.standalone.yml exec app alembic -c app/alembic.ini upgrade head | |
| bash scripts/health-check.sh https://${{ secrets.APP_DOMAIN }}/health |