Skip to content

deploy: checking-4 ci-cd #6

deploy: checking-4 ci-cd

deploy: checking-4 ci-cd #6

Workflow file for this run

name: CI/CD Pipeline
on:
push:
branches:
- deployment
pull_request:
branches:
- deployment
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
service:
- userService
- mentorService
- adminService
- courseService
- paymentService
- messagingService
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image for ${{ matrix.service }}
run: |
SERVICE_NAME=$(echo "${{ matrix.service }}" | tr '[:upper:]' '[:lower:]')
docker build -t bahirk/vision-$SERVICE_NAME:latest ./backend/services/${{ matrix.service }}
docker push bahirk/vision-$SERVICE_NAME:latest
deploy:
runs-on: ubuntu-latest
needs: build-and-push
strategy:
matrix:
service:
- userService
- mentorService
- adminService
- courseService
- paymentService
- messagingService
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up GKE context
run: |
echo ${{ secrets.GKE_KUBECONFIG }} | base64 -d > kubeconfig.yaml
export KUBECONFIG=kubeconfig.yaml
- name: Verify Kubernetes context
run: kubectl config current-context
- name: Deploy ${{ matrix.service }}
run: |
SERVICE_NAME=$(echo "${{ matrix.service }}" | tr '[:upper:]' '[:lower:]')
kubectl set image deployment/${SERVICE_NAME} ${SERVICE_NAME}=bahirk/vision-${SERVICE_NAME}:latest
kubectl rollout status deployment/${SERVICE_NAME}
#/