1
+ # non-prod
2
+ name : Build Image And Deploy
3
+
4
+ on :
5
+ push :
6
+ branches : [master, staging]
7
+
8
+ jobs :
9
+ build :
10
+ runs-on : ubicloud
11
+ steps :
12
+ - name : Checkout Code
13
+ uses : actions/checkout@v3
14
+ with :
15
+ submodules : recursive
16
+
17
+ - name : Configure AWS credentials
18
+ uses : aws-actions/configure-aws-credentials@master
19
+ with :
20
+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_NON_PROD }}
21
+ aws-secret-access-key : ${{ secrets.AWS_SECRET_KEY_NON_PROD }}
22
+ aws-region : ${{ secrets.EKS_NON_PROD_REGION }}
23
+
24
+ - name : Log in to Amazon ECR
25
+ id : login-ecr
26
+ uses : aws-actions/amazon-ecr-login@v2
27
+
28
+ - name : Build and push
29
+ uses : docker/build-push-action@v6
30
+ env :
31
+ ECR_REGISTRY : ${{ steps.login-ecr.outputs.registry }}
32
+ ECR_REPOSITORY : events-publisher
33
+ IMAGE_TAG : ${{ github.sha }}
34
+ BRANCH_NAME : ${{ github.ref_name }}
35
+ with :
36
+ context : .
37
+ push : true
38
+ tags : |
39
+ ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ env.IMAGE_TAG }}-${{ env.BRANCH_NAME }}-amd64
40
+ ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:latest-${{ env.BRANCH_NAME }}-amd64
41
+
42
+ deploy :
43
+ runs-on : ubicloud
44
+ needs : [build]
45
+ steps :
46
+ - name : Configure AWS credentials
47
+ uses : aws-actions/configure-aws-credentials@master
48
+ with :
49
+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_NON_PROD }}
50
+ aws-secret-access-key : ${{ secrets.AWS_SECRET_KEY_NON_PROD }}
51
+ aws-region : ${{ secrets.EKS_NON_PROD_REGION }}
52
+
53
+ - name : Install kubectl
54
+ uses : azure/setup-kubectl@v3
55
+ with :
56
+ version : ' v1.30.0'
57
+
58
+ - name : Configure AWS EKS Credentials
59
+ run : aws eks update-kubeconfig --name ${{ secrets.EKS_NON_PROD_CLUSTER_NAME }} --region ${{ secrets.EKS_NON_PROD_REGION }} --role-arn ${{ secrets.EKS_NON_PROD_DEPLOY_ROLE }}
60
+
61
+ - name : Restart deployment
62
+ env :
63
+ BRANCH_NAME : ${{ github.ref_name }}
64
+ run : |
65
+ kubectl rollout restart -n $BRANCH_NAME deployment/events-publisher-app
66
+ kubectl rollout restart -n $BRANCH_NAME deployment/events-ws-connection-manager-app
0 commit comments