Skip to content

Commit 01501c3

Browse files
authored
Update aws.yml
1 parent 8744ea5 commit 01501c3

File tree

1 file changed

+41
-41
lines changed

1 file changed

+41
-41
lines changed

aws.yml

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ name: Deploy to Amazon ECS
22

33
on:
44
push:
5-
branches: [ "gh-pages" ]
5+
branches: [ "main" ]
66

77
env:
8-
AWS_REGION: us-east-2 # AWS region from your EC2 and ECS details
8+
AWS_REGION: us-east-2 # AWS region
99
ECR_REPOSITORY: eoagritool # Amazon ECR repository name
1010
ECS_SERVICE: deploy # Amazon ECS service name
1111
ECS_CLUSTER: deploy # Amazon ECS cluster name
1212
ECS_TASK_DEFINITION: .aws/task-definition.json # Path to ECS task definition
13-
CONTAINER_NAME: eoagritool # Name of container in ECS task definition
13+
CONTAINER_NAME: eoagritool # Container name in ECS task definition
1414

1515
permissions:
1616
contents: read
@@ -19,49 +19,49 @@ jobs:
1919
deploy:
2020
name: Deploy to Amazon ECS
2121
runs-on: ubuntu-latest
22-
environment: production
22+
environment: production # Ensure this is correctly formatted
2323

2424
steps:
25-
- name: Checkout repository
26-
uses: actions/checkout@v4
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
2727

28-
- name: Configure AWS credentials
29-
uses: aws-actions/configure-aws-credentials@v1
30-
with:
31-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
32-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33-
aws-region: ${{ env.AWS_REGION }}
28+
- name: Configure AWS credentials
29+
uses: aws-actions/configure-aws-credentials@v1
30+
with:
31+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
32+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
33+
aws-region: ${{ env.AWS_REGION }}
3434

35-
- name: Attach Administrator Policy to IAM User
36-
run: |
37-
aws iam attach-user-policy --user-name aimty --policy-arn arn:aws:iam::aws:policy/AdministratorAccess
35+
- name: Attach Administrator Policy to IAM User
36+
run: |
37+
aws iam attach-user-policy --user-name aimty --policy-arn arn:aws:iam::aws:policy/AdministratorAccess
3838
39-
- name: Login to Amazon ECR
40-
id: login-ecr
41-
uses: aws-actions/amazon-ecr-login@v1
39+
- name: Login to Amazon ECR
40+
id: login-ecr
41+
uses: aws-actions/amazon-ecr-login@v1
4242

43-
- name: Build, tag, and push image to Amazon ECR
44-
id: build-image
45-
env:
46-
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
47-
IMAGE_TAG: ${{ github.sha }}
48-
run: |
49-
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
50-
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
51-
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
43+
- name: Build, tag, and push image to Amazon ECR
44+
id: build-image
45+
env:
46+
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
47+
IMAGE_TAG: ${{ github.sha }}
48+
run: |
49+
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
50+
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
51+
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
5252
53-
- name: Update Amazon ECS task definition with new image
54-
id: task-def
55-
uses: aws-actions/amazon-ecs-render-task-definition@v1
56-
with:
57-
task-definition: ${{ env.ECS_TASK_DEFINITION }}
58-
container-name: ${{ env.CONTAINER_NAME }}
59-
image: ${{ steps.build-image.outputs.image }}
53+
- name: Update Amazon ECS task definition with new image
54+
id: task-def
55+
uses: aws-actions/amazon-ecs-render-task-definition@v1
56+
with:
57+
task-definition: ${{ env.ECS_TASK_DEFINITION }}
58+
container-name: ${{ env.CONTAINER_NAME }}
59+
image: ${{ steps.build-image.outputs.image }}
6060

61-
- name: Deploy Amazon ECS task definition
62-
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
63-
with:
64-
task-definition: ${{ steps.task-def.outputs.task-definition }}
65-
service: ${{ env.ECS_SERVICE }}
66-
cluster: ${{ env.ECS_CLUSTER }}
67-
wait-for-service-stability: true
61+
- name: Deploy Amazon ECS task definition
62+
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
63+
with:
64+
task-definition: ${{ steps.task-def.outputs.task-definition }}
65+
service: ${{ env.ECS_SERVICE }}
66+
cluster: ${{ env.ECS_CLUSTER }}
67+
wait-for-service-stability: true

0 commit comments

Comments
 (0)