Skip to content

Commit

Permalink
feat: adding task definition prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
jw-tera committed Jan 22, 2025
1 parent 6d99912 commit 97d610c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/api_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ on:
required: false
type: string
default: ${{ inputs.APP_NAME }}
TASK_DEFINITION_PREFIX:
required: false
type: string
default: ${{ inputs.APP_NAME }}
ENV_ACCOUNT_ID:
required: true
type: string
Expand Down Expand Up @@ -270,7 +274,7 @@ jobs:
NEW_TAG: ${{ env.DOCKER_IMAGE_TAG }}
APP: ${{ inputs.ECR_REPO_NAME }}
run: |
aws ecs describe-task-definition --task-definition ${{ inputs.APP_NAME }}-task-def --query taskDefinition > task-definition.json
aws ecs describe-task-definition --task-definition ${{ inputs.TASK_DEFINITION_PREFIX }}-task-def --query taskDefinition > task-definition.json
export OLD_TAG=$(jq -r '.containerDefinitions[0] | select(.image | contains("'"$APP"'")) | .image' task-definition.json | sed 's/.*://')
jq -r '.' task-definition.json | sed "s/$OLD_TAG/$NEW_TAG/g" > temp_archivo.json && mv temp_archivo.json task-definition.json
Expand All @@ -279,7 +283,7 @@ jobs:
uses: aws-actions/amazon-ecs-deploy-task-definition@v2
with:
task-definition: task-definition.json
service: ${{ inputs.APP_NAME }}-service
service: ${{ inputs.TASK_DEFINITION_PREFIX }}-service
cluster: ${{ inputs.ECS_CLUSTER_NAME }}
wait-for-service-stability: false

Expand Down

0 comments on commit 97d610c

Please sign in to comment.