mirror of
https://github.com/zed-industries/zed.git
synced 2024-10-24 07:32:51 +00:00
40 lines
1.2 KiB
YAML
40 lines
1.2 KiB
YAML
on:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
discord_release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Get appropriate URL
|
|
id: get-appropriate-url
|
|
run: |
|
|
if [ "${{ github.event.release.prerelease }}" == "true" ]; then
|
|
url="https://zed.dev/releases/preview/latest"
|
|
else
|
|
url="https://zed.dev/releases/stable/latest"
|
|
fi
|
|
echo "::set-output name=url::$url"
|
|
|
|
- name: Prepare release content
|
|
id: prepare-content
|
|
run: |
|
|
set -eu
|
|
|
|
text="📣 Zed ${{ github.event.release.tag_name }} was just released!\n\nRestart your Zed or head to ${{ steps.get-appropriate-url.outputs.URL }} to grab it.\n\n${{ github.event.release.body }}"
|
|
|
|
maxTextLength=2000
|
|
truncationIndicator="..."
|
|
|
|
if (( ${#text} > maxTextLength )); then
|
|
text=${text:0:maxTextLength - ${#truncationIndicator}}$truncationIndicator
|
|
fi
|
|
|
|
echo "::set-output name=content::$text"
|
|
|
|
- name: Discord Webhook Action
|
|
uses: tsickert/discord-webhook@v5.3.0
|
|
with:
|
|
webhook-url: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
|
content: ${{ steps.prepare-content.outputs.content }}
|