Skip to content

Commit c29ee03

Browse files
committed
style: format deploy.yml for consistency and readability
1 parent 7f57def commit c29ee03

1 file changed

Lines changed: 74 additions & 74 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,92 @@
11
name: Deploy
22

33
on:
4-
push:
5-
branches: [main]
6-
workflow_dispatch:
7-
inputs:
8-
environment:
9-
description: Target environment
10-
required: true
11-
default: production
12-
type: choice
13-
options: [production, staging]
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
inputs:
8+
environment:
9+
description: Target environment
10+
required: true
11+
default: production
12+
type: choice
13+
options: [production, staging]
1414

1515
env:
16-
AWS_REGION: ${{ vars.AWS_REGION || 'us-east-1' }}
17-
ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY_POST_WORKER || 'backendworks/post-worker' }}
18-
ECS_CLUSTER: ${{ vars.ECS_CLUSTER || 'backendworks' }}
19-
ECS_SERVICE: ${{ vars.ECS_SERVICE_POST_WORKER || 'post-worker' }}
20-
CONTAINER_NAME: bw-post-worker
16+
AWS_REGION: ${{ vars.AWS_REGION || 'us-east-1' }}
17+
ECR_REPOSITORY: ${{ vars.ECR_REPOSITORY_POST_WORKER || 'backendworks/post-worker' }}
18+
ECS_CLUSTER: ${{ vars.ECS_CLUSTER || 'backendworks' }}
19+
ECS_SERVICE: ${{ vars.ECS_SERVICE_POST_WORKER || 'post-worker' }}
20+
CONTAINER_NAME: bw-post-worker
2121

2222
jobs:
23-
deploy:
24-
name: Build & Deploy to AWS ECS
25-
runs-on: ubuntu-latest
26-
environment: ${{ github.event.inputs.environment || 'production' }}
23+
deploy:
24+
name: Build & Deploy to AWS ECS
25+
runs-on: ubuntu-latest
26+
environment: ${{ github.event.inputs.environment || 'production' }}
2727

28-
permissions:
29-
id-token: write # OIDC token for AWS auth
30-
contents: read
28+
permissions:
29+
id-token: write # OIDC token for AWS auth
30+
contents: read
3131

32-
steps:
33-
- name: Checkout
34-
uses: actions/checkout@v4
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v4
3535

36-
- name: Setup Node
37-
uses: actions/setup-node@v4
38-
with:
39-
node-version: 20
36+
- name: Setup Node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 20
4040

41-
- name: Install dependencies
42-
run: yarn install --frozen-lockfile
43-
env:
44-
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
41+
- name: Install dependencies
42+
run: yarn install --frozen-lockfile
43+
env:
44+
NODE_AUTH_TOKEN: ${{ secrets.GH_TOKEN }}
4545

46-
- name: Build application
47-
run: npm run build
46+
- name: Build application
47+
run: npm run build
4848

49-
- name: Configure AWS credentials (OIDC)
50-
uses: aws-actions/configure-aws-credentials@v4
51-
with:
52-
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
53-
aws-region: ${{ env.AWS_REGION }}
49+
- name: Configure AWS credentials (OIDC)
50+
uses: aws-actions/configure-aws-credentials@v4
51+
with:
52+
role-to-assume: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
53+
aws-region: ${{ env.AWS_REGION }}
5454

55-
- name: Login to Amazon ECR
56-
id: login-ecr
57-
uses: aws-actions/amazon-ecr-login@v2
55+
- name: Login to Amazon ECR
56+
id: login-ecr
57+
uses: aws-actions/amazon-ecr-login@v2
5858

59-
- name: Build, tag & push Docker image
60-
id: build-image
61-
env:
62-
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
63-
IMAGE_TAG: ${{ github.sha }}
64-
run: |
65-
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
66-
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
67-
$ECR_REGISTRY/$ECR_REPOSITORY:latest
68-
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
69-
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
70-
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> "$GITHUB_OUTPUT"
59+
- name: Build, tag & push Docker image
60+
id: build-image
61+
env:
62+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
63+
IMAGE_TAG: ${{ github.sha }}
64+
run: |
65+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
66+
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
67+
$ECR_REGISTRY/$ECR_REPOSITORY:latest
68+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
69+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest
70+
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> "$GITHUB_OUTPUT"
7171
72-
- name: Download current ECS task definition
73-
run: |
74-
aws ecs describe-task-definition \
75-
--task-definition ${{ env.ECS_SERVICE }} \
76-
--query taskDefinition > task-definition.json
72+
- name: Download current ECS task definition
73+
run: |
74+
aws ecs describe-task-definition \
75+
--task-definition ${{ env.ECS_SERVICE }} \
76+
--query taskDefinition > task-definition.json
7777
78-
- name: Update task definition with new image
79-
id: task-def
80-
uses: aws-actions/amazon-ecs-render-task-definition@v1
81-
with:
82-
task-definition: task-definition.json
83-
container-name: ${{ env.CONTAINER_NAME }}
84-
image: ${{ steps.build-image.outputs.image }}
78+
- name: Update task definition with new image
79+
id: task-def
80+
uses: aws-actions/amazon-ecs-render-task-definition@v1
81+
with:
82+
task-definition: task-definition.json
83+
container-name: ${{ env.CONTAINER_NAME }}
84+
image: ${{ steps.build-image.outputs.image }}
8585

86-
- name: Deploy to ECS
87-
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
88-
with:
89-
task-definition: ${{ steps.task-def.outputs.task-definition }}
90-
service: ${{ env.ECS_SERVICE }}
91-
cluster: ${{ env.ECS_CLUSTER }}
92-
wait-for-service-stability: true
86+
- name: Deploy to ECS
87+
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
88+
with:
89+
task-definition: ${{ steps.task-def.outputs.task-definition }}
90+
service: ${{ env.ECS_SERVICE }}
91+
cluster: ${{ env.ECS_CLUSTER }}
92+
wait-for-service-stability: true

0 commit comments

Comments
 (0)