-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (82 loc) · 2.57 KB
/
ci.yml
File metadata and controls
91 lines (82 loc) · 2.57 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
name: CI
on:
pull_request:
branches:
- '**'
- '!main'
push:
branches:
- develop
jobs:
ci:
name: Lint, Test, and Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18, 20]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
- name: Run ESLint
run: npm run lint
- name: Run Tests
run: npm test
- name: Build Next.js app
run: npm run build
- name: Build Storybook
run: npm run build-storybook
notify-discord:
needs: ci
runs-on: ubuntu-latest
if: success()
steps:
- name: Send Discord Notification
env:
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
DATA: >
{
"embeds": [
{
"title": "${{
format('{0}',
(github.base_ref == 'develop' || github.ref_name == 'develop')
&& '🚀 Develop 브랜치 CI 알림'
|| '🎉 새 작업 CI 알림'
)
}}",
"description": "${{
format('{0}',
github.event_name == 'pull_request'
&& (github.base_ref == 'develop'
&& format('Develop 브랜치로 새로운 PR이 등록되었습니다! ({0} → develop)', github.head_ref)
|| format('새로운 PR이 등록되었습니다! ({0} → {1})', github.head_ref, github.base_ref)
)
|| 'Develop 브랜치에 Push가 완료되었습니다!'
)
}}",
"url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"color": 5814783,
"fields": [
{
"name": "Repository",
"value": "${{ github.repository }}"
},
{
"name": "Branch",
"value": "${{ github.event_name == 'pull_request' && github.head_ref || github.ref_name }}"
}
]
}
]
}
run: |
curl -X POST \
-H "Content-Type: application/json" \
-d "$DATA" \
$WEBHOOK_URL