Skip to content

[HotFix-1124] 키워드 도서 검색시, 첫번째로 검색된 도서를 비동기적으로 DB에 저장 로직 구현 #14

[HotFix-1124] 키워드 도서 검색시, 첫번째로 검색된 도서를 비동기적으로 DB에 저장 로직 구현

[HotFix-1124] 키워드 도서 검색시, 첫번째로 검색된 도서를 비동기적으로 DB에 저장 로직 구현 #14

name: 'book-service upload ecr & ecs'
on:
push:
branches:
- master
paths:
- 'book-service/**'
- '.github/workflows/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Setup Application Test Yaml
uses: microsoft/variable-substitution@v1
with:
files: book-service/src/main/resources/application-test.yml
env:
aladin.api.key: ${{ secrets.ALADIN_API_KEY }}
kakao.api.key: ${{ secrets.KAKAO_API_KEY }}
- name: Setup Bootstrap Yaml For Test
uses: microsoft/variable-substitution@v1
with:
files: book-service/src/main/resources/bootstrap.yml
env:
spring.profiles.active: test
- name: Test with Gradle
working-directory: book-service
run: |
./gradlew test
- name: Setup Bootstrap Yaml For Build
uses: microsoft/variable-substitution@v1
with:
files: book-service/src/main/resources/bootstrap.yml
env:
spring.profiles.active: prod
- name: Build with Gradle
working-directory: book-service
run: |
./gradlew clean build -x test
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ECR_ECS_ACCESS_KEY }}
aws-secret-access-key: ${{ secrets.AWS_ECR_ECS_SECRET_KEY }}
aws-region: ${{ secrets.ECR_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.ECR_BOOK_SERVICE_REPOSITORY }}
IMAGE_TAG: ${{ github.sha }}
working-directory: book-service
run: |
docker build --platform amd64 -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ./book-service/task-definition.json
container-name: bookService
image: ${{ steps.build-image.outputs.image }}
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: bookService-EcsService
cluster: MybraryCluster
codedeploy-deployment-group: DgpECS-MybraryCluster-bookService-EcsService
codedeploy-appspec: ./book-service/appspec.yaml
wait-for-service-stability: true