Deploy to Server (Production) #1
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 Server | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Tag to deploy (latest or specific SHA)" | |
| required: false | |
| default: "latest" | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: SSH deploy (compose pull/up) | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.PROD_SERVER_HOST }} | |
| username: ${{ secrets.PROD_SERVER_USER }} | |
| key: ${{ secrets.PROD_SERVER_SSH_KEY }} | |
| script: | | |
| # login to GHCR (private) | |
| echo "${{ secrets.GHCR_PAT }}" | docker login ghcr.io -u "${{ secrets.GHCR_USERNAME }}" --password-stdin | |
| # если используешь docker-compose.yml с latest — просто pull/up: | |
| cd /opt/algotecture | |
| docker compose pull | |
| docker compose up -d | |
| docker image prune -f |