Aradhakrishnan gfdl patch 5 #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: Deploy to ECS. Build, push image, | |
on: | |
pull_request: | |
branches: | |
- main | |
env: | |
AWS_REGION: us-east-1 # set this to your preferred AWS region, e.g. us-west-1 | |
ECR_REPOSITORY: mdtf/mdtf-test # set this to your Amazon ECR repository name | |
ECS_SERVICE: custom-service # MY_ECS_SERVICE set this to your Amazon ECS service name | |
ECS_CLUSTER: mdtf-east1 # MY_ECS_CLUSTER set this to your Amazon ECS cluster name | |
ECS_TASK_DEFINITION: ecs-task-defn.json # set this to the path to your Amazon ECS task definition | |
# file, e.g. .aws/task-definition.json | |
CONTAINER_NAME: mdtf-test-a1r # set this to the name of the container in the | |
# containerDefinitions section of your task definition MY_CONTAINER_NAME | |
jobs: | |
deploy: | |
name: push-to-public-ecr-cache-test | |
runs-on: ubuntu-latest | |
environment: dev | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@13d241b293754004c80624b5567555c4a39ffbe3 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Build, tag, and push image to Amazon ECR | |
id: build-image | |
uses: aradhakrishnanGFDL/docker-build-with-cache-action@master #support-aws-ecr-public | |
env: | |
ECR_REGISTRY: public.ecr.aws | |
IMAGE_TAG: "latest" | |
ECS_IMAGE: $ECR_REGISTRY/ECR_REPOSITORY:$env.IMAGE_TAG | |
with: | |
registry: public.ecr.aws | |
username: "${{ secrets.AWS_ACCESS_KEY_ID }}" | |
password: "${{ secrets.AWS_SECRET_ACCESS_KEY }}" | |
image_name: c6h4h4s8/mdtf/mdtf-test | |
push_image_and_stages: true | |
image_tag: latest | |
- name: Fill in the new image ID in the Amazon ECS task definition | |
id: task-def | |
uses: aws-actions/amazon-ecs-render-task-definition@97587c9d45a4930bf0e3da8dd2feb2a463cf4a3a | |
with: | |
task-definition: ${{ env.ECS_TASK_DEFINITION }} | |
container-name: ${{ env.CONTAINER_NAME }} | |
image: public.ecr.aws/c6h4h4s8/mdtf/mdtf-test:latest | |
- name: Deploy Amazon ECS task definition | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v1.4.10 | |
with: | |
task-definition: ${{ steps.task-def.outputs.task-definition }} | |
service: ${{ env.ECS_SERVICE }} | |
cluster: ${{ env.ECS_CLUSTER }} | |
wait-for-service-stability: true |