-
Notifications
You must be signed in to change notification settings - Fork 2
67 lines (58 loc) · 2.36 KB
/
release.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
name: Deploy to Production Environment
on:
release:
types: [released]
env:
AWS_REGION: "us-west-2"
ECR_REPOSITORY: "aidingapp"
jobs:
deploy:
name: Deploy
runs-on: ubuntu-22.04
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.head_ref }}
token: ${{ secrets.PAT }}
- name: Configure AWS credentials
# SHA of release v4.0.2
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
with:
aws-access-key-id: ${{ secrets.PROD_AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PROD_AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
# SHA of release v2.0.1
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.event.release.tag_name }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --target deploy --platform linux/amd64 --build-arg USER_ID=9999 --build-arg GROUP_ID=9999 .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
# SHA of release v1.2.0
uses: aws-actions/amazon-ecs-render-task-definition@4225e0b507142a2e432b018bc3ccb728559b437a
with:
task-definition: "docker/devops/ecs/aidingapp/aidingapp-prod-task-definition.json"
container-name: "app"
image: ${{ steps.build-image.outputs.image }}
- name: Deploy Amazon ECS task definition
# SHA of release v1.4.11
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: "aidingapp-prod-service"
cluster: "aidingapp-prod"
wait-for-service-stability: true