Skip to content

Remove extra default update #10

Remove extra default update

Remove extra default update #10

name: Build ECS Toolchain Image
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::068738303278:role/GithubECSRepoPolicy
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
# Setting up Docker Buildx with docker-container driver is required
# Setting up Docker Buildx with docker-container driver is required
# at the moment to be able to use a subdirectory with Git context
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Debug
run: 'echo Branch name: "${{ github.head_ref || github.ref_name }}"'
# Always push with the branch name, this allows for external testing
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:docker"
tags: 068738303278.dkr.ecr.us-east-1.amazonaws.com/elastic-common-schema-toolchain:${{ github.head_ref || github.ref_name }}
cache-from: type=registry,ref=068738303278.dkr.ecr.us-east-1.amazonaws.com/elastic-common-schema-toolchain:cache
cache-to: mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=068738303278.dkr.ecr.us-east-1.amazonaws.com/elastic-common-schema-toolchain:cache
push: true
build-args: |
BRANCH=${{ github.head_ref || github.ref_name }}
# Once it's in main, we want to update to the latest stable version
- name: Push Latest Tag
if: github.ref_name == 'main'
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:docker"
tags: 068738303278.dkr.ecr.us-east-1.amazonaws.com/elastic-common-schema-toolchain:latest
cache-from: type=registry,ref=068738303278.dkr.ecr.us-east-1.amazonaws.com/elastic-common-schema-toolchain:cache
cache-to: mode=max,image-manifest=true,oci-mediatypes=true,type=registry,ref=068738303278.dkr.ecr.us-east-1.amazonaws.com/elastic-common-schema-toolchain:cache
push: true
build-args: |
BRANCH=${{ github.ref_name }}