MOA-510: 쿠폰취소를 위한 api 인증없이 사용가능하도록 변경, 메세지에서 이모지 제거 #45
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: ✨ MoA backend Batch DEV CD ✨ | |
env: | |
PROFILE: dev | |
IMAGE_TAG: back-dev-batch-${{ secrets.APP_VERSION_TAG }} | |
DOCKER_CONTAINER_NAME: backend-batch | |
DOCKER_HUB_REPOSITORY: moagift/moa_server | |
APPLICATION: batch | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- develop | |
paths: | |
- "core/**" | |
- "batch/**" | |
- ".github/workflows/dev-batch-cd.yml" | |
jobs: | |
backend-docker-build-and-push: | |
runs-on: ubuntu-latest | |
steps: | |
- name: ✨ Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
token: ${{ secrets.ACTION_TOKEN }} | |
- name: ✨ JDK 21 설정 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'temurin' | |
- name: ✨ Gradle Caching | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: ✨ Gradlew 권한 설정 | |
run: chmod +x ./gradlew | |
- name: ✨ Jar 파일 빌드 | |
run: ./gradlew ${{ env.APPLICATION }}:bootJar | |
- name: ✨ DockerHub에 로그인 | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: ✨ Docker Image 빌드 후 DockerHub에 Push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./ | |
file: ./${{ env.APPLICATION }}/Dockerfile | |
push: true | |
platforms: linux/amd64 | |
tags: ${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }} | |
backend-docker-pull-and-run: | |
runs-on: [ self-hosted, dev ] | |
if: ${{ needs.backend-docker-build-and-push.result == 'success' }} | |
needs: [ backend-docker-build-and-push ] | |
steps: | |
- name: ✨ DockerHub 에서 Image Pull | |
run: | | |
docker login --username '${{ secrets.DOCKER_HUB_USERNAME }}' --password '${{ secrets.DOCKER_HUB_PASSWORD }}' | |
docker pull ${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }} | |
docker stop ${{ env.DOCKER_CONTAINER_NAME }} || true | |
docker container prune -f | |
docker image prune -f | |
- name: ✨ Docker Image 실행 | |
run: | | |
docker run \ | |
-d \ | |
--name ${{ env.DOCKER_CONTAINER_NAME }} \ | |
-p 18080:8080 \ | |
-e "SPRING_PROFILES_ACTIVE=${{ env.PROFILE }}" \ | |
${{ env.DOCKER_HUB_REPOSITORY }}:${{ env.IMAGE_TAG }} |