-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (51 loc) · 2.18 KB
/
deploy_uat.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
name: Deploy UAT
on:
push:
branches:
- development
jobs:
deploy:
runs-on: self-hosted
environment: UAT
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-to-assume: ${{ secrets.AWS_ECR_DEPLOYMENT_ROLE }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: BACK-END - Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ secrets.AWS_ECR_REPO_BACKEND }}
IMAGE_TAG: uat
run: |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG -f Dockerfile.backend .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
- name: FRONT-END - Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: ${{ secrets.AWS_ECR_REPO_FRONTEND }}
IMAGE_TAG: uat
run: |
docker build --build-arg ${{ secrets.FRONTEND_DOCKER_BUILD_ARGS }} -t $REGISTRY/$REPOSITORY:$IMAGE_TAG -f Dockerfile.frontend .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
- name: Setup AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
role-to-assume: ${{ secrets.AWS_DEPLOYMENT_ROLE }}
- name: Deploy new backend task
run: |
aws ecs update-service --cluster ${{ secrets.AWS_ECS_CLUSTER }} --service ${{ secrets.AWS_ECS_DJANGO_SERVICE }} --force-new-deployment
- name: Deploy new backend task
run: |
aws ecs update-service --cluster ${{ secrets.AWS_ECS_CLUSTER }} --service ${{ secrets.AWS_ECS_NODE_SERVICE }} --force-new-deployment