-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.87 KB
/
deploy-webapp.yml
File metadata and controls
61 lines (51 loc) · 1.87 KB
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
name: Deploy Certification Webapp to ECS
on:
push:
branches: [main]
env:
AWS_REGION: us-west-1
ECR_REPOSITORY: certification-webapp
ECS_SERVICE: certification-webapp
ECS_CLUSTER: certification-cluster
permissions:
id-token: write
contents: read
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::975232045453:role/github-actions-deploy-role
aws-region: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build and push image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build \
--build-arg NEXT_PUBLIC_HCS_TOPIC_ID="${{ vars.NEXT_PUBLIC_HCS_TOPIC_ID }}" \
--build-arg NEXT_PUBLIC_AUTH0_REDIRECT_URI="${{ vars.NEXT_PUBLIC_AUTH0_REDIRECT_URI }}" \
--build-arg NEXT_PUBLIC_AUTH0_POST_LOGOUT_REDIRECT_URI="${{ vars.NEXT_PUBLIC_AUTH0_POST_LOGOUT_REDIRECT_URI }}" \
--build-arg NEXT_PUBLIC_ONBOARDING_URL="${{ vars.NEXT_PUBLIC_ONBOARDING_URL }}" \
-t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
- name: Deploy to ECS
run: |
aws ecs update-service \
--cluster ${{ env.ECS_CLUSTER }} \
--service ${{ env.ECS_SERVICE }} \
--force-new-deployment \
--desired-count 1
aws ecs wait services-stable \
--cluster ${{ env.ECS_CLUSTER }} \
--services ${{ env.ECS_SERVICE }}
- name: Deployment Summary
run: |
echo "🚀 Deployment successful!"
echo "🔗 Service: ${{ env.ECS_SERVICE }}"
echo "🌐 Cluster: ${{ env.ECS_CLUSTER }}"