-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yaml
50 lines (50 loc) · 1.6 KB
/
action.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Service
description: Creates new task revision and update ECR service
inputs:
aws-region:
description: AWS region
required: true
default: 'eu-west-1'
environment:
description: Target CDK environment
required: true
role:
description: Assume role
required: true
service-name:
description: Service name
required: true
default: admin
repository:
description: ECR respository name
required: true
default: techloop/admin
runs:
using: composite
steps:
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Download task definition
env:
ENVIRONMENT: ${{ inputs.environment }}
SERVICE_NAME: ${{ inputs.service-name }}
shell: bash
run: |
aws ecs describe-task-definition --task-definition $SERVICE_NAME-$ENVIRONMENT-definition --query taskDefinition > task-definition.json
- name: Fill in the new image ID
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: ${{ inputs.service-name }}-container
image: ${{ steps.login-ecr.outputs.registry }}/${{ env.REPOSITORY }}:${{ github.sha }}
- name: Deploy new task revision
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
env:
ENVIRONMENT: ${{ inputs.environment }}
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ inputs.service-name }}
cluster: ${{ inputs.environment }}-admin
wait-for-service-stability: false