-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.52 KB
/
EKS-CICD.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: twoge-cicd
on:
push:
branches:
- eks
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
AWS_REGION: 'us-east-1'
EKS_CLUSTER_NAME: 'cpclass-eks-cluster'
jobs:
CI:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: eks
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}
- name: Build & Push Docker Image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ env.DOCKER_USERNAME }}/twoge:latest
CD:
needs: CI
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
ref: eks
- 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-region: ${{ env.AWS_REGION }}
- name: Set up Kubectl for EKS
uses: aws-actions/amazon-eks-kubectl-set-context@v1
with:
cluster-name: ${{ env.EKS_CLUSTER_NAME }}
region: ${{ env.AWS_REGION }}
- name: Deploy to EKS
run: |
kubectl apply -f k8s/ -n steve