Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Merge pull request #43 from klaytn/dev #13

Merge pull request #43 from klaytn/dev

Merge pull request #43 from klaytn/dev #13

Workflow file for this run

name: Build & push container image
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
submodules: true
- name: Get AWS ops credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.AWS_IAM_ROLE_ARN_PROD }}
role-session-name: github-action-tx-latency-measurement
aws-region: ${{ secrets.AWS_REGION }}
- name: Login to Amazon ECR
uses: aws-actions/amazon-ecr-login@v1
id: login-ecr
- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.AWS_ECR_REPOSITORY_PROD }}
run: |
git_hash=$(git rev-parse --short "$GITHUB_SHA")
for dir in */; do
dir=${dir%/}
if [ -f "$dir/Dockerfile" ]; then
cd $dir
echo "Building image in $dir"
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$dir-$git_hash .
cd -
fi
done
docker push $ECR_REGISTRY/$ECR_REPOSITORY --all-tags