Skip to content

Commit bc37345

Browse files
Added unit testing, code quality, dockerize and update the deployment job
1 parent 4f1c0fd commit bc37345

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

.github/workflows/recommendation.yaml

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,49 @@ jobs:
5353
flake8 . --max-line-length=100 --exclude=demo_pb2.py,demo_pb2_grpc.py,venv
5454
continue-on-error: true
5555

56-
56+
build-and-push:
57+
runs-on: ubuntu-latest
58+
needs: [unit-testing, code-quality]
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
63+
- name: Install Docker
64+
uses: docker/setup-buildx-action@v1
65+
66+
- name: Login to Docker
67+
uses: docker/login-action@v2
68+
with:
69+
username: ${{ secrets.DOCKER_USERNAME }}
70+
password: ${{ secrets.DOCKER_PASSWORD }}
71+
72+
- name: Build and push Docker image
73+
uses: docker/build-push-action@v3
74+
with:
75+
context: .
76+
file: ./src/recommendation/Dockerfile
77+
78+
push: true
79+
tags: neamulkabiremon/recommendation:${{ github.sha }}
80+
81+
update-k8s-deployment:
82+
runs-on: ubuntu-latest
83+
needs: build-and-push
84+
steps:
85+
- name: Checkout code
86+
uses: actions/checkout@v4
87+
with:
88+
token: ${{ secrets.GITHUB_TOKEN }}
89+
90+
- name: Update Kubernetes Deployment
91+
run: |
92+
sed -i "s|image: .*|image: ${{ secrets.DOCKER_USERNAME }}/recommendation:${{ github.sha }}|" kubernetes/recommendation/deploy.yaml
93+
cat kubernetes/recommendation/deploy.yaml
94+
95+
- name: Commit and push updated Kubernetes manifest
96+
run: |
97+
git config --global user.email "neamulkabiremon@gmail.com"
98+
git config --global user.name "neamulkabiremon"
99+
git add kubernetes/recommendation/deploy.yaml
100+
git commit -m "[CI]: Update checkout deployment image tag"
101+
git push

0 commit comments

Comments
 (0)