diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f0e139d..f9bbdd2 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -100,105 +100,3 @@ jobs: bash shared/scripts/test-sequential.sh env: NODE_ENV: test - - # ========================================================================== - # Build Job - # ========================================================================== - build: - runs-on: ubuntu-latest - needs: test - permissions: - contents: read - packages: write - outputs: - image_tag: ${{ steps.meta.outputs.tags }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Log in to Container Registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=sha,prefix= - type=raw,value=latest - - - name: Build and Push Docker Image - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile.prod - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - # ========================================================================== - # Deploy Job - # ========================================================================== - deploy: - runs-on: ubuntu-latest - needs: build - environment: production - - steps: - - name: Deploy to Production Server - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.VPS_HOST }} - username: ${{ secrets.VPS_USER }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - script: | - cd ~/Aurora - - # Pull latest code - git pull origin main - - # Pull latest Docker image - docker compose -f docker-compose.prod.yml pull 2>/dev/null || true - - # Build and restart containers - docker compose -f docker-compose.prod.yml build --no-cache - docker compose -f docker-compose.prod.yml down - docker compose -f docker-compose.prod.yml up -d - - # Wait for health checks - sleep 15 - - # Verify deployment - docker ps | grep aurora - - # Cleanup old images - docker image prune -f - - - name: Verify Deployment - uses: appleboy/ssh-action@v1.0.3 - with: - host: ${{ secrets.VPS_HOST }} - username: ${{ secrets.VPS_USER }} - key: ${{ secrets.SSH_PRIVATE_KEY }} - script: | - # Check if app container is healthy - if docker ps | grep -q "aurora_app.*healthy"; then - echo "✅ Deployment successful - aurora_app is healthy" - exit 0 - else - echo "⚠️ Health check pending, checking container status..." - docker ps | grep aurora - docker logs aurora_app --tail 20 - exit 0 - fi