generated from CS3219-AY2324S1/course-assessment-template
-
Notifications
You must be signed in to change notification settings - Fork 6
63 lines (52 loc) · 1.98 KB
/
gateway.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
name: Gateway CD
on:
push:
branches: [ "main", "staging" ]
permissions:
contents: read
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up environment
run: |
echo "NEXT_PUBLIC_PORT_NUMBER=3001" >> .env
echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> .env
cat .env # Verify that secrets are set
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: latest
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker-compose -f docker-compose-deployment.yml build
# Push gateway container to ecr
docker tag ay2324s1-course-assessment-g58_gateway:$IMAGE_TAG $ECR_REGISTRY/ay2324s1-course-assessment-g58-gateway:$IMAGE_TAG
docker push $ECR_REGISTRY/ay2324s1-course-assessment-g58-gateway:$IMAGE_TAG
echo "push image=gateway" >> $GITHUB_OUTPUT
- name: Download gateway-service task definition
run: |
aws ecs describe-task-definition --task-definition peerprep-api-gateway --query taskDefinition > gateway-task-definition.json
- name: Deploy Amazon ECS api-gateway task
uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a
with:
task-definition: gateway-task-definition.json
service: api-gateway
cluster: peerprep_t
wait-for-service-stability: true