hotfix(tgbot): try to connect #23
Workflow file for this run
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: Build and Publish | |
| on: | |
| push: | |
| branches: ["practika-develop", "develop"] | |
| jobs: | |
| build-server: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Server | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./server | |
| push: true | |
| tags: ${{ secrets.DOCKER_USERNAME }}/eduplatform-server:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-web: | |
| needs: build-server | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Web | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./frontend | |
| file: frontend/packages/web/Dockerfile | |
| push: true | |
| tags: ${{ secrets.DOCKER_USERNAME }}/eduplatform-web:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-admin: | |
| needs: build-web | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Admin | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./frontend | |
| file: frontend/packages/admin/Dockerfile | |
| push: true | |
| tags: ${{ secrets.DOCKER_USERNAME }}/eduplatform-admin:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-tgbot: | |
| needs: build-admin | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Bot | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./tgbot | |
| push: true | |
| tags: ${{ secrets.DOCKER_USERNAME }}/eduplatform-tgbot:latest | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| deploy-to-new-vm: | |
| needs: build-tgbot | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Copy compose via ssh | |
| uses: appleboy/scp-action@master | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USER }} | |
| password: ${{ secrets.SSH_PASSPHRASE }} | |
| source: "docker-compose.yml" | |
| target: "eduplatform/" | |
| - name: Deploy via SSH | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.HOST }} | |
| username: ${{ secrets.USER }} | |
| password: ${{ secrets.SSH_PASSPHRASE }} | |
| script: | | |
| cd ~/eduplatform | |
| docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
| export DOCKER_USERNAME=${{ secrets.DOCKER_USERNAME }} | |
| docker compose down || true | |
| docker compose pull | |
| docker compose up -d --build --remove-orphans | |
| # === ВРЕМЕННЫЕ ЛОГИ ДЛЯ ДЕБАГА === | |
| echo "--- LOGS FOR WEB CONTAINER ---" | |
| docker compose logs --tail=50 web | |
| echo "--- LOGS FOR ADMIN CONTAINER ---" | |
| docker compose logs --tail=50 admin | |
| echo "--- LOGS FOR SERVER CONTAINER ---" | |
| docker compose logs --tail=50 server | |
| # ===================================== | |
| docker system prune -af |