Skip to content

fix cli test failure #18

fix cli test failure

fix cli test failure #18

name: CLI Deploy to Amazon ECR
on:
pull_request:
branches:
- master
paths:
- "cli/**"
types:
- closed
env:
ecr_url: public.ecr.aws/bisonai/orakl-cli
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('./cli/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-cli
run: docker-compose -f cli/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(cli)
run: |
docker tag orakl-cli ${{ 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 }}