Skip to content

Commit 91ad494

Browse files
committed
2 parents c99554f + c66f967 commit 91ad494

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

.github/workflows/CI-CD.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy Docker to k8s
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
workflow_dispatch:
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
12+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
13+
AWS_REGION: ${{ secrets.AWS_REGION }}
14+
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
15+
16+
jobs:
17+
wait-previous-run:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: mktcode/consecutive-workflow-action@v1 # please read security note
21+
with:
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
build-frontend-image:
25+
runs-on: ubuntu-latest
26+
needs: [wait-previous-run]
27+
permissions:
28+
contents: read
29+
packages: write
30+
31+
steps:
32+
- name: Checkout repository
33+
uses: actions/checkout@v2
34+
35+
- name: Log in to the github container registry
36+
uses: docker/login-action@master
37+
with:
38+
registry: ${{ env.REGISTRY }}
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Build and push Frontend Docker image
43+
uses: docker/build-push-action@master
44+
with:
45+
file: Dockerfile
46+
push: true
47+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
48+
49+
deploy-k8s:
50+
needs: [ build-frontend-image, wait-previous-run]
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- name: Configure AWS credentials
55+
uses: aws-actions/configure-aws-credentials@v1
56+
with:
57+
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
58+
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
59+
aws-region: ${{ env.AWS_REGION }}
60+
61+
- name: Deploy to k8s
62+
uses: sergeyfilyanin/kubectl-aws-eks@master
63+
with:
64+
args: rollout restart deployment vara-stats -n vara

0 commit comments

Comments
 (0)