diff --git a/.github/workflows/announce_release.yml b/.github/workflows/announce_release.yml new file mode 100644 index 000000000..6eedb74e7 --- /dev/null +++ b/.github/workflows/announce_release.yml @@ -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 \ No newline at end of file diff --git a/public/announce_release.py b/public/announce_release.py new file mode 100644 index 000000000..cdcff4ef8 --- /dev/null +++ b/public/announce_release.py @@ -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.") \ No newline at end of file diff --git a/public/discord-avatar.png b/public/discord-avatar.png new file mode 100644 index 000000000..33fe44c1e Binary files /dev/null and b/public/discord-avatar.png differ