[Fix] week date 구분자 변경 #107
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: Deploy Backend | |
| on: | |
| push: | |
| branches: [deploy] | |
| jobs: | |
| backend: | |
| name: Deploy Backend to EC2 | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Create .env file& Build backend | |
| run: | | |
| cd backend/pirocheck | |
| echo DB_HOST=${{ secrets.DB_HOST }} >> .env | |
| echo DB_PORT=${{ secrets.DB_PORT }} >> .env | |
| echo DB_NAME=${{ secrets.DB_NAME }} >> .env | |
| echo DB_USER=${{ secrets.DB_USER }} >> .env | |
| echo DB_PASSWORD=${{ secrets.DB_PASSWORD }} >> .env | |
| chmod +x gradlew | |
| ./gradlew build -x test --no-daemon | |
| - name: Restore PEM file | |
| run: | | |
| echo "${{ secrets.EC2_SSH_KEY }}" | base64 -d > pirocheck.pem | |
| chmod 400 pirocheck.pem | |
| - name: Copy JAR to EC2 | |
| run: | | |
| scp -o StrictHostKeyChecking=no -i pirocheck.pem backend/pirocheck/build/libs/*.jar ubuntu@${{ secrets.EC2_HOST }}:/home/ubuntu/ | |
| - name: Restart Spring Boot on EC2 | |
| run: | | |
| ssh -o StrictHostKeyChecking=no -i pirocheck.pem ubuntu@${{ secrets.EC2_HOST }} 'bash ~/restart.sh' | |
| - name: Send Discord notification (Success) | |
| if: success() | |
| run: | | |
| curl -H "Content-Type: application/json" \ | |
| -X POST \ | |
| -d '{ | |
| "embeds": [{ | |
| "title": "🚀 Deploy Back 성공!", | |
| "description": "**Branch**: `${{ github.ref }}`\n**Commit**: `${{ github.sha }}`\n🟢 서비스가 정상적으로 배포되었습니다!", | |
| "color": 65353 | |
| }] | |
| }' ${{ secrets.DISCORD_WEBHOOK }} | |
| - name: Send Discord notification (Failure) | |
| if: failure() | |
| run: | | |
| curl -H "Content-Type: application/json" \ | |
| -X POST \ | |
| -d '{ | |
| "embeds": [{ | |
| "title": "❌ Deploy Back 실패!", | |
| "description": "**Branch**: `${{ github.ref }}`\n**Commit**: `${{ github.sha }}`\n🔴 배포 중 오류가 발생했습니다. 로그를 확인하세요.", | |
| "color": 16711680 | |
| }] | |
| }' ${{ secrets.DISCORD_WEBHOOK }} |