|
|
|
name: Release Notification
|
|
|
|
|
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [published]
|
|
|
|
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
|
|
|
tag_name:
|
|
|
|
required: true
|
|
|
|
type: string
|
|
|
|
description: The release tag to generate a notification for
|
|
|
|
|
|
|
|
env:
|
|
|
|
TAG: ${{ github.event.release.tag_name || github.event.inputs.tag_name }}
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
notify:
|
|
|
|
name: Discord Notification
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- uses: octokit/request-action@v2.x
|
|
|
|
id: release
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
with:
|
|
|
|
route: GET /repos/{org_repo}/releases/tags/{tag}
|
|
|
|
org_repo: ${{ github.repository }}
|
|
|
|
tag: ${{ env.TAG }}
|
|
|
|
|
|
|
|
- uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: '3.x'
|
|
|
|
|
|
|
|
- run: pip install discord-webhook
|
|
|
|
|
|
|
|
# Write changelog to a file to avoid certain characters from being processed by the shell
|
|
|
|
- run: |
|
|
|
|
cat >changelog.txt <<"EOL"
|
|
|
|
${{ fromJSON(steps.release.outputs.data).body }}
|
|
|
|
EOL
|
|
|
|
|
|
|
|
- run: |
|
|
|
|
python ci/notify/discord_notify.py \
|
|
|
|
'${{ env.TAG }}' \
|
|
|
|
'${{ secrets.DISCORD_WEBHOOK }}' \
|
|
|
|
changelog.txt
|