Skip to content

Commit 8eed2f1

Browse files
authored
Merge pull request #82 from highfive-goorm/feature/setup-cicd
ci: CI 설정 파일 수정
2 parents 15a7fed + cc7b621 commit 8eed2f1

1 file changed

Lines changed: 33 additions & 4 deletions

File tree

.github/workflows/ci-cd.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,45 @@ jobs:
6161
needs: build
6262
runs-on: ubuntu-latest
6363
steps:
64+
- name: Download build log artifact
65+
uses: actions/download-artifact@v4
66+
with:
67+
name: build-log-${{ needs.build.outputs.version_tag }}
68+
69+
# ▼▼▼ [1단계] 로그를 필터링하여 보낼 메시지를 준비하는 단계 ▼▼▼
70+
- name: Prepare Notification Message
71+
id: prepare_message # 이 스텝의 출력을 참조하기 위해 id 지정
72+
run: |
73+
KEYWORDS="error|failed|warning|deprecated"
74+
LOG_ISSUES=$(grep -i -E -C 2 "$KEYWORDS" build_log.txt || true)
75+
76+
if [[ -z "$LOG_ISSUES" ]]; then
77+
SUMMARY="✅ 빌드 로그에서 특별한 경고나 에러가 발견되지 않았습니다."
78+
else
79+
TRUNCATED_LOGS=$(echo "$LOG_ISSUES" | head -c 1500)
80+
SUMMARY="⚠️ 빌드 로그에서 잠재적인 문제가 발견되었습니다. 아래 요약을 확인해주세요.\\n\\n**Log Issues Summary:**\\n\`\`\`\\n${TRUNCATED_LOGS}\\n\`\`\`"
81+
fi
82+
83+
# 다음 스텝에서 사용할 수 있도록 summary 내용을 output으로 설정
84+
# EOF를 사용하여 여러 줄의 문자열을 안정적으로 전달
85+
{
86+
echo "summary<<EOF"
87+
echo "$SUMMARY"
88+
echo "EOF"
89+
} >> "$GITHUB_OUTPUT"
90+
91+
# ▼▼▼ [2단계] 준비된 메시지를 담아 Discord 알림을 보내는 단계 ▼▼▼
6492
- name: Send Discord Notification for ECR Push Approval
6593
uses: sarisia/actions-status-discord@v1
66-
if: always()
6794
with:
6895
webhook: ${{ secrets.DISCORD_WEBHOOK_URL }}
6996
title: "🔎 [1차 승인] ECR Push 승인 요청: ${{ needs.build.outputs.version_tag }}"
97+
# description에 바로 앞 스텝의 'summary' output을 사용
7098
description: |
71-
Docker 이미지 빌드가 완료되었습니다. ECR에 이미지를 Push 하려면 아래 링크에서 승인해주세요.
72-
[➡️ 빌드 로그 확인 및 승인하기](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
73-
color: 0x00BFFF
99+
${{ steps.prepare_message.outputs.summary }}
100+
101+
[➡️ 전체 로그 및 승인 페이지로 이동](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
102+
color: 49151 # 16진수 0x00BFFF
74103

75104
# =====================================
76105
# JOB 3: ECR 푸시 실행 (1차 승인 게이트)

0 commit comments

Comments
 (0)