-
Notifications
You must be signed in to change notification settings - Fork 8
30 lines (27 loc) · 1002 Bytes
/
release-notification.yml
File metadata and controls
30 lines (27 loc) · 1002 Bytes
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
name: Release Notification
on:
release:
types: [published]
jobs:
notify:
runs-on: ubuntu-latest
steps:
- name: Build Slack payload
id: message
if: ${{ env.SLACK_WEBHOOK_URL != '' }}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
TAG: ${{ github.event.release.tag_name }}
RELEASE_NAME: ${{ github.event.release.name }}
URL: ${{ github.event.release.html_url }}
run: |
TEXT=$(printf '🚀 *Visitran %s* released! %s <%s|View Release Notes>' "$TAG" "$RELEASE_NAME" "$URL")
PAYLOAD=$(jq -nc --arg text "$TEXT" '{"text": $text}')
echo "payload=$PAYLOAD" >> "$GITHUB_OUTPUT"
- name: Post to Slack
if: ${{ steps.message.outputs.payload != '' }}
uses: slackapi/slack-github-action@v2.1.0
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
payload: ${{ steps.message.outputs.payload }}