-
-
Notifications
You must be signed in to change notification settings - Fork 66
65 lines (59 loc) · 1.91 KB
/
notify.yml
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
name: Notify
on:
workflow_call:
inputs:
build-flavor:
required: true
type: string
build-title:
required: true
type: string
secrets:
DISCORD_WEBHOOK_EDGE:
required: true
DISCORD_WEBHOOK_BETA:
required: true
DISCORD_WEBHOOK_STABLE:
required: true
jobs:
discord:
name: Discord
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Determine Webhook Channel
id: webhook
uses: actions/github-script@v6
env:
DISCORD_WEBHOOK_EDGE: ${{ secrets.DISCORD_WEBHOOK_EDGE }}
DISCORD_WEBHOOK_BETA: ${{ secrets.DISCORD_WEBHOOK_BETA }}
DISCORD_WEBHOOK_STABLE: ${{ secrets.DISCORD_WEBHOOK_STABLE }}
BUILD_FLAVOR: ${{ inputs.build-flavor }}
with:
result-encoding: string
script: |
switch (process.env.BUILD_FLAVOR) {
case 'beta': return process.env.DISCORD_WEBHOOK_BETA;
case 'stable': return process.env.DISCORD_WEBHOOK_STABLE;
case 'edge':
default: return process.env.DISCORD_WEBHOOK_EDGE;
}
- name: Create Discord Embed
id: embed
uses: actions/github-script@v6
env:
BUILD_FLAVOR: ${{ inputs.build-flavor }}
BUILD_TITLE: ${{ inputs.build-title }}
with:
result-encoding: string
script: return require('.github/scripts/notify_discord_embed.js')();
- name: Send Discord Message
uses: Ilshidur/[email protected]
env:
DISCORD_WEBHOOK: ${{ steps.webhook.outputs.result }}
DISCORD_USERNAME: LunaSea Support
DISCORD_AVATAR: https://raw.githubusercontent.com/JagandeepBrar/lunasea/master/assets/icon/icon.png
DISCORD_EMBEDS: ${{ steps.embed.outputs.result }}