docker-compose-v2.0.5 #37
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: CD Pipeline | |
| on: | |
| release: | |
| types: [published] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Check what secrets are available | |
| run: | | |
| echo "=== Checking Secrets ===" | |
| echo "SSH_HOST exists: ${{ secrets.SSH_HOST != '' }}" | |
| echo "SSH_PORT exists: ${{ secrets.SSH_PORT != '' }}" | |
| echo "SSH_USERNAME exists: ${{ secrets.SSH_USERNAME != '' }}" | |
| echo "SSH_PRIVATE_KEY exists: ${{ secrets.SSH_PRIVATE_KEY != '' }}" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Deploy Docker Compose container via ssh | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ${{ secrets.SSH_USERNAME }} | |
| key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| port: ${{ secrets.SSH_PORT }} | |
| script: | | |
| echo "=== Starting Docker Compose Deployment ===" | |
| echo "Pulling latest images..." | |
| echo "${{ secrets.VM_PASS }}" | sudo -S docker compose -f /home/user/Desktop/lab1/catty-reminders-app/docker-compose.yml pull | |
| echo "Stopping and removing containers..." | |
| echo "${{ secrets.VM_PASS }}" | sudo -S docker compose -f /home/user/Desktop/lab1/catty-reminders-app/docker-compose.yml down | |
| echo "Starting new stack..." | |
| echo "${{ secrets.VM_PASS }}" | sudo -S docker compose -f /home/user/Desktop/lab1/catty-reminders-app/docker-compose.yml up -d | |
| echo "Checking stack status..." | |
| echo "${{ secrets.VM_PASS }}" | sudo -S docker compose -f /home/user/Desktop/lab1/catty-reminders-app/docker-compose.yml ps | |
| echo "Deployment completed! Check: http://app.turmanidze.course.prafdin.ru" |