-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (93 loc) · 2.9 KB
/
ci-develop.yml
File metadata and controls
104 lines (93 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: ci-develop
on:
pull_request:
branches: [develop]
types: [opened, synchronize, reopened]
paths-ignore:
- '**/*.md'
jobs:
build:
runs-on: ubuntu-latest
environment: develop
permissions:
contents: read
checks: write
pull-requests: write
steps:
# 1. 코드 체크아웃
- name: 🔄 Code Checkout
uses: actions/checkout@v4
# 2. JDK 21 설정
- name: ⛏️ Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
# 3. Gradle 설정
- name: 🛠️ Set up Gradle
uses: gradle/actions/setup-gradle@v3
# 4. gradlew 실행 권한 부여
- name: 🗣️ Grant execute permission for gradlew
run: chmod +x gradlew
# 5. 빌드
- name: 🔆 Build
run: ./gradlew clean build -x test
# 6. Discord 알림
- name: ✉️ Send CI Result to Discord
if: always()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
JOB_STATUS: ${{ job.status }}
ACTOR: ${{ github.actor }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
run: |
if [ "$JOB_STATUS" = "success" ]; then
STATUS_EMOJI="✅"
STATUS_TEXT="성공"
COLOR=3066993
else
STATUS_EMOJI="❌"
STATUS_TEXT="실패"
COLOR=15158332
fi
PR_URL="https://github.com/$REPO/pull/$PR_NUMBER"
DEBUG_URL="https://github.com/$REPO/actions/runs/$RUN_ID"
payload=$(jq -n \
--arg title "$STATUS_EMOJI Develop CI $STATUS_TEXT" \
--arg pr_title "$PR_TITLE" \
--arg pr_url "$PR_URL" \
--arg actor "$ACTOR" \
--arg debug_url "$DEBUG_URL" \
--argjson color "$COLOR" \
'{
embeds: [
{
title: $title,
color: $color,
fields: [
{
name: "📋 Pull Request",
value: "[\($pr_title)](\($pr_url))",
inline: false
},
{
name: "👤 담당자",
value: $actor,
inline: false
},
{
name: "🔍 로그",
value: "[Actions 로그 보기](\($debug_url))",
inline: false
}
]
}
]
}')
curl -X POST \
-H "Content-Type: application/json" \
-d "$payload" \
"$DISCORD_WEBHOOK"