This repository has been archived by the owner on Jul 22, 2024. It is now read-only.
Merge pull request #53 from ara-klaytn/L1finalisation #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & push container image | |
on: | |
push: | |
branches: | |
- dev | |
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 |