Skip to content

refactor(nexus-gateway): drop nexus-gateway (#660) #403

refactor(nexus-gateway): drop nexus-gateway (#660)

refactor(nexus-gateway): drop nexus-gateway (#660) #403

name: ampd (push to main) - Build and push image to ECR
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build-and-push-latest-docker-image:
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
env:
REPOSITORY: axelar-amplifier
IMAGE_TAG: ${{ github.sha }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: fetch tags
run: |
git fetch --unshallow
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ghwf-${{ github.event.repository.name }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: check if an image already build on same commit hash
id: image-tag-check
run: |
image_tag_exists=$(aws ecr batch-get-image --repository-name ${REPOSITORY} --image-ids "imageTag=${IMAGE_TAG}" | jq '.images | length')
echo "image_tag_exists=${image_tag_exists}" >> $GITHUB_OUTPUT
- uses: docker/setup-buildx-action@v3
if: steps.image-tag-check.outputs.image_tag_exists == 0
- uses: docker/build-push-action@v5
if: steps.image-tag-check.outputs.image_tag_exists == 0
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
with:
context: .
push: true
tags: ${{env.REGISTRY}}/${{env.REPOSITORY}}:${{env.IMAGE_TAG}}
file: ampd/Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max