Skip to content

Commit 6e90329

Browse files
author
Satej Sawant
committed
Add separate API Gateway deployment workflow
1 parent 8622077 commit 6e90329

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy API Gateway
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths: ['api-gateway/**']
7+
workflow_dispatch:
8+
9+
env:
10+
AWS_REGION: us-west-2
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
id-token: write
17+
contents: read
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Configure AWS credentials
23+
uses: aws-actions/configure-aws-credentials@v5
24+
with:
25+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
26+
aws-region: ${{ env.AWS_REGION }}
27+
28+
- name: Login to ECR
29+
uses: aws-actions/amazon-ecr-login@v2
30+
31+
- name: Build and push image
32+
run: |
33+
docker build -t ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-west-2.amazonaws.com/spookymart-api-gateway:${{ github.sha }} ./api-gateway
34+
docker push ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-west-2.amazonaws.com/spookymart-api-gateway:${{ github.sha }}
35+
36+
- name: Deploy API Gateway
37+
uses: aws-actions/amazon-ecs-deploy-express-service@v1
38+
with:
39+
service-name: spookymart-api-gateway
40+
image: ${{ secrets.AWS_ACCOUNT_ID }}.dkr.ecr.us-west-2.amazonaws.com/spookymart-api-gateway:${{ github.sha }}
41+
execution-role-arn: ${{ secrets.ECS_EXECUTION_ROLE_ARN }}
42+
infrastructure-role-arn: ${{ secrets.ECS_INFRASTRUCTURE_ROLE_ARN }}
43+
container-port: 3000

0 commit comments

Comments
 (0)