✨ feat: 클로저테이블 적용하지 않은 폴더 경로 조회 구현 #123
Workflow file for this run
This file contains hidden or 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: Backend - CI/CD (JAR Deploy) | |
| on: | |
| pull_request: | |
| branches: [develop] | |
| push: | |
| branches: [develop] | |
| paths-ignore: | |
| - '**.md' | |
| - '**/README*' | |
| jobs: | |
| ci: | |
| name: CI (Build JAR) | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' || github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build with Gradle | |
| run: ./gradlew clean build -x test | |
| cd: | |
| name: CD (Deploy to EC2) | |
| runs-on: ubuntu-latest | |
| needs: ci | |
| if: github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build with Gradle | |
| run: ./gradlew clean bootJar -x test | |
| - name: Copy JAR to EC2 | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| source: "build/libs/*SNAPSHOT.jar" | |
| target: "/home/ubuntu/app/" | |
| - name: Restart via PM2 (SSM inject) | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| if ! command -v pm2 >/dev/null 2>&1; then | |
| npm i -g pm2 | |
| fi | |
| # 스크립트/PM2 설정이 없다면 최초 1회만 업로드 or 여기서 생성 | |
| pm2 startOrRestart /home/ubuntu/app/ecosystem.config.js --update-env | |
| pm2 save | |
| notify: | |
| name: Discord Notification | |
| runs-on: ubuntu-latest | |
| needs: [ci, cd] | |
| if: always() | |
| steps: | |
| - name: Send Discord Notification | |
| run: | | |
| CI_RESULT="${{ needs.ci.result || 'skipped' }}" | |
| CD_RESULT="${{ needs.cd.result || 'skipped' }}" | |
| COLOR="8359053" | |
| STATUS="⚪ CI/CD 실행됨" | |
| if [ "$CI_RESULT" = "success" ]; then | |
| STATUS="✅ CI 성공" | |
| COLOR="5763719" | |
| elif [ "$CI_RESULT" = "failure" ]; then | |
| STATUS="❌ CI 실패" | |
| COLOR="15158332" | |
| fi | |
| if [ "$CD_RESULT" = "success" ]; then | |
| STATUS="✅ CD 성공 (PM2 배포 완료)" | |
| COLOR="3066993" | |
| elif [ "$CD_RESULT" = "failure" ]; then | |
| STATUS="❌ CD 실패 (PM2 배포 오류)" | |
| COLOR="15158332" | |
| fi | |
| curl -X POST -H "Content-Type: application/json" \ | |
| -d "{ | |
| \"embeds\": [{ | |
| \"title\": \"🔔 GitHub Actions 결과: ${{ github.workflow }}\", | |
| \"description\": \"$STATUS\n브랜치: \`${{ github.ref_name }}\`\n커밋: \`${{ github.actor }}\`\n[👉 실행 로그 보기](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\", | |
| \"color\": $COLOR | |
| }] | |
| }" \ | |
| ${{ secrets.DISCORD_DEPLOY_WEBHOOK_URL }} |