-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (30 loc) · 1.05 KB
/
cd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Deploy to EKS
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-session-token: ${{ secrets.AWS_SESSION_TOKEN }}
aws-region: us-east-1
- name: Update kube config
run: aws eks update-kubeconfig --name carlohcs-k8s-cluster --region us-east-1
- name: Login to DockerHub
run: docker login -u carlohcs -p ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
run: |
docker build -t carlohcs/kubernetes-ci-cd-github-actions .
docker push carlohcs/kubernetes-ci-cd-github-actions
- name: Deploy to EKS
run: |
kubectl apply -f k8s/node-deployment.yaml
kubectl apply -f k8s/node-service.yaml