ci: Discord embed logic updated to support multiple architectures

pull/47/head
Robert Dailey 2 years ago
parent 25f852743a
commit 279804004e

@ -9,13 +9,13 @@ jobs:
name: Discord Notification
runs-on: ubuntu-latest
steps:
- run: wget https://raw.githubusercontent.com/rcdailey/trash-updater/master/ci/notify/discord_notify.py
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- run: pip install discord-webhook
- run: |
python discord_notify.py \
python ci/notify/discord_notify.py \
'${{ github.event.release.tag_name }}' \
'${{ secrets.DISCORD_WEBHOOK }}' \
'${{ github.event.release.body }}'

@ -34,14 +34,14 @@ embed.set_author(
url='https://github.com/rcdailey/trash-updater',
icon_url='https://github.com/rcdailey/trash-updater/blob/master/ci/notify/trash-icon.png?raw=true')
embed.add_embed_field(name='Linux (x64)',
value=f'[Download](https://github.com/rcdailey/trash-updater/releases/download/{version}/trash-linux-x64.zip)')
embed.add_embed_field(name='Windows (x64)',
value=f'[Download](https://github.com/rcdailey/trash-updater/releases/download/{version}/trash-win-x64.zip)')
embed.add_embed_field(name='MacOS (x64)',
value=f'[Download](https://github.com/rcdailey/trash-updater/releases/download/{version}/trash-osx-x64.zip)')
def add_links(os_name, archs, os):
url_base = f'https://github.com/rcdailey/trash-updater/releases/download/{version}'
download_links = ', '.join(f'[{arch}]({url_base}/trash-{os}-{arch}.zip)' for arch in archs)
embed.add_embed_field(name=os_name, value=f'[{download_links}]')
add_links('Linux', ('x64', 'arm', 'arm64'), 'linux')
add_links('Windows', ('x64', 'arm64'), 'win')
add_links('MacOS', ('x64', 'arm64'), 'osx')
webhook = DiscordWebhook(webhook_url)
webhook.add_embed(embed)

Loading…
Cancel
Save