GitHub ActionsでECSのタスク定義のみを更新する

GitHub ActionsでECSサービスをデプロイするときによく使われる aws-actions/amazon-ecs-deploy-task-definition ですが、 タスク定義のみを更新することもできます。READMEのサンプルコードにはその例がないので、気づきにくいです。

inputs:
  task-definition:
    description: 'The path to the ECS task definition file to register'
    required: true
  service:
    description: 'The name of the ECS service to deploy to. The action will only register the task definition if no service is given.'
    required: false

amazon-ecs-deploy-task-definition/action.yml at 6d98f28115f7e2c01d1aff47de6e7bd5b7c22540 · aws-actions/amazon-ecs-deploy-task-definition · GitHub

inputsにtask-definitionだけ入力してあげるだけでOKです。

# 中略
    - name: register new task definition family
      uses: aws-actions/amazon-ecs-deploy-task-definition@v1
      with:
        task-definition: ${{ steps.render-container.outputs.task-definition }}

ECS Scheduled Taskでバッチ処理するタスク定義の更新などで活用できると思います。

参考