Skip to content

[BE/FEAT] : DTO Validation 수정 #38

[BE/FEAT] : DTO Validation 수정

[BE/FEAT] : DTO Validation 수정 #38

name: testAndDeploy
on:
pull_request:
types:
- closed
permissions: write-all
defaults:
run:
working-directory: ./BE/exceed
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- run: |
echo The PR was merged
build:
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Gradle
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: Build with Gradle Wrapper
run: ./gradlew build
- name: PR Comment on Jacoco Report
id: jacoco
uses: madrapps/jacoco-report@v1.2
with:
title: 테스트 커버리지 리포트입니다
paths: ${{ github.workspace }}/backend/build/reports/jacoco/test/jacocoTestReport.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 30
- name: Send docker-compose.yml
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: ./BE/exceed/docker-compose.yml
target: /home/ubuntu/backend-deploy
- name: Send resources-develop-environment
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: ./BE/exceed/resources/gaebaljip-develop-environment
target: /home/ubuntu/backend-deploy
- name: Create .env file
run: |
echo "${{ secrets.ENV_VARS }}" > .env
- name: Send env file
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
source: ./BE/exceed/.env
target: /home/ubuntu/backend-deploy
- name: Docker Image Build
run: docker build -t ${{ secrets.DOCKER_HUB_USER_NAME }}/gaebaljip-dev:latest .
- name: Docker Hub Login
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USER_NAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: docker Hub Push
run: docker push ${{ secrets.DOCKER_HUB_USER_NAME }}/gaebaljip-dev:latest
- name: SSH Deploy
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
script: |
cd backend-deploy/BE/exceed
sudo docker-compose down
sudo docker pull ${{ secrets.DOCKER_HUB_USER_NAME }}/gaebaljip-dev:latest
sudo docker-compose up --build -d
sudo docker image prune -a -f