|
1
|
name: Send release notifications |
|
2
|
on: |
|
3
|
release: |
|
4
|
types: [published] |
|
5
|
|
|
6
|
jobs: |
|
7
|
send-notification: |
|
8
|
runs-on: ubuntu-latest |
|
9
|
steps: |
|
10
|
- name: Cancel Previous Runs |
|
11
|
uses: styfle/cancel-workflow-action@0.11.0 |
|
12
|
with: |
|
13
|
access_token: ${{ github.token }} |
|
14
|
|
|
15
|
- name: Checkout |
|
16
|
uses: actions/checkout@v3 |
|
17
|
with: |
|
18
|
fetch-depth: 0 |
|
19
|
|
|
20
|
- name: Setup Node.js environment |
|
21
|
uses: actions/setup-node@v4 |
|
22
|
with: |
|
23
|
node-version: 22 |
|
24
|
cache: "yarn" |
|
25
|
|
|
26
|
- name: Post to Slack channel |
|
27
|
id: slack |
|
28
|
uses: slackapi/slack-github-action@v1.23.0 |
|
29
|
with: |
|
30
|
channel-id: "releases" |
|
31
|
payload: | |
|
32
|
{ |
|
33
|
"blocks":[ |
|
34
|
{ |
|
35
|
"type": "header", |
|
36
|
"text": { |
|
37
|
"type": "plain_text", |
|
38
|
"text": "${{ github.event.release.tag_name}} is out! 🚢" |
|
39
|
} |
|
40
|
}, |
|
41
|
{ |
|
42
|
"type": "section", |
|
43
|
"text": { |
|
44
|
"type": "mrkdwn", |
|
45
|
"text": "${{ github.event.release.html_url }}" |
|
46
|
} |
|
47
|
} |
|
48
|
] |
|
49
|
} |
|
50
|
env: |
|
51
|
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_RELEASE }} |
|
52
|
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |
|
53
|
|
|
54
|
- name: Generate Discord Notification |
|
55
|
id: notification |
|
56
|
run: message=$(node ./scripts/generate-discord-message.js '${{ github.event.release.tag_name}}' '${{ github.event.release.html_url }}') && echo ::set-output name=message::${message//$'\n'/'%0A'} |
|
57
|
|
|
58
|
- name: Discord Notification |
|
59
|
id: discord-notification |
|
60
|
env: |
|
61
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }} |
|
62
|
uses: Ilshidur/action-discord@0.3.2 |
|
63
|
with: |
|
64
|
args: ${{ steps.notification.outputs.message }} |