Skip to content

GitHub Actions

ECS Deployer can also be used on GitHub Actions using our official action.

Usage

Tip

For the most up-to-date info, please visit the ECS Deployer GitHub Action page.

Recommend Directory Structure

<repo root>
├── .ecsdeployer.yml
└── .github
    └── workflows
    └── deploy.yml
<repo root>
├── .ecsdeployer
│   ├── beta.yml
│   ├── production.yml
│   └── staging.yml
└── .github
    └── workflows
    └── deploy.yml

Configuring

Action Inputs

config

Path to the configuration file that will be used for deploying your application.

Default: .ecsdeployer.yml

image

Sets the container image URI to use as the primary image.

If you pass this, you should not define an image section on your project root. If provide this parameter and have an image section defined, the section in the file will win.

image-tag

Optional value passed as --image-tag to deployment. This is used for the {{ .Tag }} template variable.

Default: (not set)

app-version

Optional value passed as --app-version to deployment. This is used for the {{ .AppVersion }} template variable.

Default: (not set)

extra-args

Additional arguments to pass to the deploy command

Default: (none)

workdir

Working directory (below repository root)

Default: .

timeout

Sets the timeout for the entire deployment process.

Default: (not set - use the default timeout for ECS Deployer)

install-only

Just install ECS Deployer, and then exit

Default: false

ecsdeployer-version

Override the version of ECSDeployer to run.

Default: latest

Example Workflow

.github/workflows/deploy.yml
name: "Deploy"
on:
  push:
    tags:
      - 'v**'

# only 1 deployment at a time. (optional)
concurrency: ecsdeployer

permissions:
  contents: read

  # this is only needed if you are using OIDC auth for your AWS Role.
  # If you are using AWS, you should definitely set this up!
  id-token: write

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          role-to-assume: arn:aws:iam::12345678910:role/deployment-role
          aws-region: us-east-1

      - name: Login to Amazon ECR
        id: login-ecr
        uses: aws-actions/amazon-ecr-login@v1

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v2

      - name: Setup up Docker Buildx
        uses: docker/setup-buildx-action@v2

      - name: Build Push
        uses: docker/build-push-action@v3
        with:
          push: true
          tags: ${{ steps.login-ecr.outputs.registry }}/myapp:${{ github.ref_name }}

      - name: Deploy
        uses: ecsdeployer/github-action@v1
        with:
          image: ${{ steps.login-ecr.outputs.registry }}/myapp:${{ github.ref_name }}
Download this file

Further Reading