-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·109 lines (96 loc) · 3.4 KB
/
build.sh
File metadata and controls
executable file
·109 lines (96 loc) · 3.4 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
105
106
107
108
109
#!/bin/bash
# A temporary script for building rosen app inside vercel, due to vercel
# character limitation for build command
# This file should be removed when #24 is implemented
# Default app is default if not specified
APP=${1:-default}
echo "building monorepo packages for app '$APP' ..."
if [ "$APP" == "rosen-service" ]; then
npm run build --workspace packages/constants
npm run build --workspace packages/types
npm run build --workspace packages/asset-calculator
fi
if [ "$APP" == "guard" ] || [ "$APP" == "watcher" ] || [ "$APP" == "rosen" ] || [ "$APP" == "default" ]; then
npm run build --workspace packages/constants
npm run build --workspace packages/types
npm run build --workspace packages/utils
npm run build --workspace packages/icons
npm run build --workspace packages/swr-helpers
npm run build --workspace packages/ui-kit
fi
if [ "$APP" == "rosen" ] || [ "$APP" == "default" ]; then
npm run build --workspace packages/asset-calculator
npm run build --workspace packages/asset-aggregator
npm run build --workspace packages/asset-data-adapter
npm run build --workspace networks/base
npm run build --workspace networks/evm
npm run build --workspace networks/binance
npm run build --workspace networks/bitcoin
npm run build --workspace networks/bitcoin-runes
npm run build --workspace networks/doge
npm run build --workspace networks/cardano
npm run build --workspace networks/ergo
npm run build --workspace networks/ethereum
npm run build --workspace wallets/wallet-api
npm run build --workspace wallets/eternl
npm run build --workspace wallets/lace
npm run build --workspace wallets/metamask
npm run build --workspace wallets/nautilus
npm run build --workspace wallets/okx
npm run build --workspace wallets/my-doge
npm run build --workspace wallets/xverse
npm run build --workspace wallets/wallet-connect
fi
if [ "$APP" == "default" ] || [ "$APP" == "rosen" ] || [ "$APP" == "rosen-service" ]; then
npm run build --workspace packages/rosen-statistics-entity
npm run build --workspace packages/public-status
npm run build --workspace packages/data-source
npm run build --workspace packages/rosen-statistics
fi
# Check if Discord webhook URL is set
if [ -z "$DISCORD_NOTIFICATION_WEBHOOK_URL" ]; then
echo "Discord webhook URL not set. Skipping notification."
exit 0
fi
# Prepare the embed JSON
JSON_PAYLOAD=$(cat <<EOF
{
"embeds": [
{
"title": "🚀 New Deployment Notification",
"color": 3447003,
"description": "A new deployment has been triggered on **Vercel**.",
"fields": [
{
"name": "📱 App",
"value": "${APP}",
"inline": false
},
{
"name": "🌍 Branch URL",
"value": "$([ -n "$VERCEL_BRANCH_URL" ] && echo "[$VERCEL_BRANCH_URL](https://$VERCEL_BRANCH_URL)" || echo "N/A")",
"inline": false
},
{
"name": "📜 Commit Message",
"value": "${VERCEL_GIT_COMMIT_MESSAGE:-N/A}",
"inline": false
},
{
"name": "🔖 Commit Ref",
"value": "${VERCEL_GIT_COMMIT_REF:-N/A}",
"inline": false
}
],
"timestamp": "$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
}
]
}
EOF
)
# Send the message via Discord webhook
curl -X POST \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD" \
"$DISCORD_NOTIFICATION_WEBHOOK_URL"
echo "Discord notification sent!"