-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (62 loc) · 2.06 KB
/
deploy.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
64
65
66
67
68
69
70
71
72
name: Deploy
on:
workflow_dispatch:
push:
branches:
- main
env:
ECR_REGISTRY: 132721373801.dkr.ecr.ap-south-1.amazonaws.com/discord_discordx
KUBE_CONTAINER_NAME: discordx
KUBE_DEPLOYMENT_NAME: discordx
KUBE_NAMESPACE: discord
jobs:
build:
name: Build
runs-on: ubuntu-latest
outputs:
image_uri: ${{ steps.tag.outputs.current }}
steps:
- name: check out code 🛎
uses: actions/checkout@main
- name: check out buildx
uses: docker/setup-buildx-action@master
id: buildx
with:
install: true
- name: Prepare Tag
id: tag
run: |
echo "current=${{ env.ECR_REGISTRY }}:`date +"%y.%m.%d.%H.%M"`" >> $GITHUB_OUTPUT
echo "latest=${{ env.ECR_REGISTRY }}:latest" >> $GITHUB_OUTPUT
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@main
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-south-1
mask-aws-account-id: "no"
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@main
- name: Build and Push
uses: docker/build-push-action@master
with:
push: true
tags: ${{ steps.tag.outputs.current }}, ${{ steps.tag.outputs.latest }}
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: deploy to cluster
uses: kodermax/kubectl-aws-eks@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: set image deployment/${{ env.KUBE_DEPLOYMENT_NAME }} ${{ env.KUBE_CONTAINER_NAME }}=${{ needs.build.outputs.image_uri }} -n ${{ env.KUBE_NAMESPACE }}
- name: verify deployment
uses: kodermax/kubectl-aws-eks@master
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
args: rollout status deployment/${{ env.KUBE_DEPLOYMENT_NAME }} -n ${{ env.KUBE_NAMESPACE }}