Skip to content

.github/workflows/cd.yml #1

.github/workflows/cd.yml

.github/workflows/cd.yml #1

Workflow file for this run

name: CD Pipeline
on:
workflow_run:
workflows: ["CI Pipeline"]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Deploy to Server
uses: appleboy/ssh-action@v0.1.10
with:
host: ${{ secrets.SERVER_HOST }}
username: ${{ secrets.SERVER_USER }}
key: ${{ secrets.SERVER_PRIVATE_KEY }}
script: |
echo "Pulling latest images from DockerHub..."
docker pull ${{ secrets.DOCKER_USERNAME }}/leetcode-api-gateway:latest
docker pull ${{ secrets.DOCKER_USERNAME }}/leetcode-users-service:latest
docker pull ${{ secrets.DOCKER_USERNAME }}/leetcode-auth-service:latest
docker pull ${{ secrets.DOCKER_USERNAME }}/leetcode-problems-service:latest
docker pull ${{ secrets.DOCKER_USERNAME }}/leetcode-tags-service:latest
docker pull ${{ secrets.DOCKER_USERNAME }}/leetcode-companies-service:latest
docker pull ${{ secrets.DOCKER_USERNAME }}/leetcode-submissions-service:latest
docker pull ${{ secrets.DOCKER_USERNAME }}/leetcode-execution-service:latest
echo "Restarting services..."
cd /path/to/your/deployment/folder
docker compose down
docker compose up -d
echo "Deployment completed successfully!"