-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (56 loc) · 1.61 KB
/
main-deploy.yml
File metadata and controls
62 lines (56 loc) · 1.61 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
name: Deploy to production (main)
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
deploy-production:
name: Deploy to Production
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x]
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: Build Next.js app
run: npm run build
notify-discord:
needs: deploy-production
runs-on: ubuntu-latest
if: success()
steps:
- name: Send Discord Notification
env:
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
DATA: >
{
"embeds": [
{
"title": "🚀 main 브랜치 알림",
"description": "${{ github.event_name == 'pull_request' && '새로운 PR이 성공적으로 등록되었습니다!' || 'Push가 성공적으로 완료되었습니다!' }}",
"url": "${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"color": 5814783,
"fields": [
{
"name": "Repository",
"value": "${{ github.repository }}"
}
]
}
]
}
run: |
curl -X POST \
-H "Content-Type: application/json" \
-d "$DATA" \
$WEBHOOK_URL