aws-actions / amazon-ecs-render-task-definition

Inserts a container image URI into an Amazon ECS task definition JSON file.
MIT License
261 stars 142 forks source link

How to create a new revision for an existing task definition? #239

Closed HAZ1BAN closed 1 year ago

HAZ1BAN commented 1 year ago

Suppose I use this "render task definition" task to create a new task definition. But then, how do I create a new revision the next time I run the workflow? Can we have like, an environment variable or something that will just increment revision values every time the workflow runs so that it can create a new revision of that task definition?

alextweneymackenzie-ibi commented 1 year ago
      - name: Get task definition
        run: |
          aws ecs describe-task-definition \
            --task-definition ${{ vars.ECS_TASK_DEFINITION }} \
            --query taskDefinition > task-definition.json

      - name: Render task definition
        id: render-task-definition
        uses: aws-actions/amazon-ecs-render-task-definition@v1
        with:
          task-definition: task-definition.json
          container-name: ${{ vars.CONTAINER }}
          image: ghcr.io/${{ env.repo }}:${{ env.tag }}

      - name: Deploy task definition
        uses: aws-actions/amazon-ecs-deploy-task-definition@v1
        with:
          task-definition: ${{ steps.render-task-definition.outputs.task-definition }}
          service: ${{ vars.ECS_SERVICE }}
          cluster: ${{ vars.ECS_CLUSTER }}
          wait-for-service-stability: true

Hopefully this is helpful for you. I set this up after reading this.

HAZ1BAN commented 1 year ago

Oh, looks like I misunderstood the Deploy task definition task with Deploy ECS Service. No worries, it works like a charm. Thanks for the support, we can close this request. :)