v1.6.2 #19
Workflow file for this run
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
name: Deploy to Amazon ECS | |
on: | |
release: | |
types: [published] | |
env: | |
AWS_REGION: eu-north-1 | |
ECR_REGISTRY: 590877988961.dkr.ecr.eu-north-1.amazonaws.com | |
ECR_REPOSITORY: adserver-api | |
ECS_SERVICE: test-adserver-api | |
ECS_CLUSTER: production | |
ECS_TASK_DEFINITION: aws/ecs/taskdef.json | |
CONTAINER_NAME: test-adserver | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3) | |
- name: Configure AWS ECS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.ECS_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.ECS_AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Fill in the new image ID in the Amazon ECS task definition | |
id: task-def | |
uses: aws-actions/amazon-ecs-render-task-definition@v1 | |
with: | |
task-definition: ${{ env.ECS_TASK_DEFINITION }} | |
container-name: ${{ env.CONTAINER_NAME }} | |
image: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPOSITORY }}:${{ steps.get_version.outputs.VERSION }} | |
- name: Deploy Amazon ECS task definition | |
uses: aws-actions/amazon-ecs-deploy-task-definition@v1 | |
with: | |
task-definition: ${{ steps.task-def.outputs.task-definition }} | |
service: ${{ env.ECS_SERVICE }} | |
cluster: ${{ env.ECS_CLUSTER }} | |
wait-for-service-stability: true |