Skip to content

(CORE) Add error code and catch error (#1132) #92

(CORE) Add error code and catch error (#1132)

(CORE) Add error code and catch error (#1132) #92

name: Core Deploy to Amazon ECR
on:
push:
branches:
- master
paths:
- "core/**"
workflow_dispatch:
env:
ecr_url: public.ecr.aws/bisonai/orakl-core
jobs:
prepare:
name: Prepare Build
runs-on: ubuntu-latest
outputs:
tag_date: ${{ steps.tag.outputs.date }}
tag_git_hash: ${{ steps.tag.outputs.git_hash }}
version: ${{ steps.package.outputs.version }}
steps:
- uses: actions/checkout@v3
- name: Get time TAG
id: tag
run: |
echo "date=$(date +'%Y%m%d.%H%M')" >> $GITHUB_OUTPUT
echo "git_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get package version
id: package
run: |
echo "version=$(node -p -e "require('./core/package.json').version")" >> $GITHUB_OUTPUT
build:
name: Build
runs-on: ubuntu-latest
needs: prepare
permissions:
id-token: write
contents: read
outputs:
tag_date: ${{ steps.tag.outputs.date }}
tag_git_hash: ${{ steps.tag.outputs.git_hash }}
steps:
- uses: actions/checkout@v3
- name: Docker build orakl-core
run: SERVICE_NAME=orakl-core docker-compose -f docker-compose.build.yaml build
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.ROLE_ARN }}
- name: Login to Amazon ECR
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
- name: Publish Image to ECR(core)
run: |
docker tag orakl-core ${{ env.ecr_url }}:v${{ needs.prepare.outputs.version }}.${{ needs.prepare.outputs.tag_date }}.${{ needs.prepare.outputs.tag_git_hash }}
docker push ${{ env.ecr_url }}:v${{ needs.prepare.outputs.version }}.${{ needs.prepare.outputs.tag_date }}.${{ needs.prepare.outputs.tag_git_hash }}