Add Discord release updates automation (#1346)
adding Discord release updates automation
This commit is contained in:
29
.github/workflows/announce_release.yml
vendored
Normal file
29
.github/workflows/announce_release.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
name: Announce Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
announce_release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install requests
|
||||||
|
|
||||||
|
- name: Announce Release
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||||
|
RELEASE_VERSION: ${{ github.event.release.tag_name }}
|
||||||
|
RELEASE_BODY: ${{ github.event.release.body}}
|
||||||
|
run: python public/announce_release.py
|
26
public/announce_release.py
Normal file
26
public/announce_release.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
import requests
|
||||||
|
import os
|
||||||
|
|
||||||
|
webhook_url = os.getenv('DISCORD_WEBHOOK_URL')
|
||||||
|
release_version = os.getenv('RELEASE_VERSION')
|
||||||
|
release_body = os.getenv('RELEASE_BODY')
|
||||||
|
|
||||||
|
# message to send to Discord
|
||||||
|
data = {
|
||||||
|
"content":
|
||||||
|
f'''
|
||||||
|
**{release_version}** is now available! Check out the latest features and improvements here: https://zoo.dev/modeling-app/download
|
||||||
|
{release_body}
|
||||||
|
''',
|
||||||
|
"username": "Modeling App Release Updates",
|
||||||
|
"avatar_url": "https://raw.githubusercontent.com/KittyCAD/modeling-app/main/public/discord-avatar.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
# POST request to the Discord webhook
|
||||||
|
response = requests.post(webhook_url, json=data)
|
||||||
|
|
||||||
|
# Check for success
|
||||||
|
if response.status_code == 204:
|
||||||
|
print("Successfully sent the message to Discord.")
|
||||||
|
else:
|
||||||
|
print("Failed to send the message to Discord.")
|
BIN
public/discord-avatar.png
Normal file
BIN
public/discord-avatar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
Reference in New Issue
Block a user