From 90607c867dee85d54f7bf15b02ee365d551aa3fd Mon Sep 17 00:00:00 2001 From: techartdev Date: Tue, 24 Feb 2026 17:44:36 +0200 Subject: [PATCH] relocate release workflow --- .../workflows/release-discord.yaml | 68 ------------------- .github/workflows/release-discord.yaml | 68 +++++++++++++++++++ 2 files changed, 68 insertions(+), 68 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/workflows/release-discord.yaml create mode 100644 .github/workflows/release-discord.yaml diff --git a/.github/ISSUE_TEMPLATE/workflows/release-discord.yaml b/.github/ISSUE_TEMPLATE/workflows/release-discord.yaml deleted file mode 100644 index 363198e..0000000 --- a/.github/ISSUE_TEMPLATE/workflows/release-discord.yaml +++ /dev/null @@ -1,68 +0,0 @@ -name: Announce release to Discord - -on: -release: -types: [published] - -permissions: -contents: read - -jobs: -notify-discord: -runs-on: ubuntu-latest -steps: -- name: Post release announcement to Discord -env: -DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} -RELEASE_NAME: ${{ github.event.release.name }} -RELEASE_TAG: ${{ github.event.release.tag_name }} -RELEASE_URL: ${{ github.event.release.html_url }} -RELEASE_BODY: ${{ github.event.release.body }} -REPO: ${{ github.repository }} -run: | -if [ -z "$DISCORD_WEBHOOK_URL" ]; then -echo "DISCORD_WEBHOOK_URL is not configured; skipping." -exit 0 -fi - -if [ -n "$RELEASE_NAME" ]; then -TITLE="$RELEASE_NAME" -else -TITLE="$RELEASE_TAG" -fi - -BODY_CLEAN=$(printf '%s' "$RELEASE_BODY" | sed 's/\r//g') -BODY_TRIM=$(printf '%s' "$BODY_CLEAN" | sed '/^[[:space:]]*$/d') - -if [ -n "$BODY_TRIM" ]; then -SUMMARY=$(printf '%s' "$BODY_TRIM" | head -c 1400) -else -SUMMARY="No release notes provided." -fi - -PAYLOAD=$(jq -n \ ---arg title "🚀 New release published: $TITLE" \ ---arg repo "$REPO" \ ---arg tag "$RELEASE_TAG" \ ---arg url "$RELEASE_URL" \ ---arg summary "$SUMMARY" \ -'{ -content: "", -embeds: [ -{ -title: $title, -url: $url, -color: 5814783, -fields: [ -{name: "Repository", value: $repo, inline: true}, -{name: "Tag", value: $tag, inline: true}, -{name: "Release URL", value: $url, inline: false}, -{name: "Release notes", value: $summary, inline: false} -] -} -] -}') - -curl -sS -X POST "$DISCORD_WEBHOOK_URL" \ --H "Content-Type: application/json" \ --d "$PAYLOAD" diff --git a/.github/workflows/release-discord.yaml b/.github/workflows/release-discord.yaml new file mode 100644 index 0000000..de852ba --- /dev/null +++ b/.github/workflows/release-discord.yaml @@ -0,0 +1,68 @@ +name: Announce release to Discord + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + notify-discord: + runs-on: ubuntu-latest + steps: + - name: Post release announcement to Discord + env: + DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} + RELEASE_NAME: ${{ github.event.release.name }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_URL: ${{ github.event.release.html_url }} + RELEASE_BODY: ${{ github.event.release.body }} + REPO: ${{ github.repository }} + run: | + if [ -z "$DISCORD_WEBHOOK_URL" ]; then + echo "DISCORD_WEBHOOK_URL is not configured; skipping." + exit 0 + fi + + if [ -n "$RELEASE_NAME" ]; then + TITLE="$RELEASE_NAME" + else + TITLE="$RELEASE_TAG" + fi + + BODY_CLEAN=$(printf '%s' "$RELEASE_BODY" | sed 's/\r//g') + BODY_TRIM=$(printf '%s' "$BODY_CLEAN" | sed '/^[[:space:]]*$/d') + + if [ -n "$BODY_TRIM" ]; then + SUMMARY=$(printf '%s' "$BODY_TRIM" | head -c 1400) + else + SUMMARY="No release notes provided." + fi + + PAYLOAD=$(jq -n \ + --arg title "🚀 New release published: $TITLE" \ + --arg repo "$REPO" \ + --arg tag "$RELEASE_TAG" \ + --arg url "$RELEASE_URL" \ + --arg summary "$SUMMARY" \ + '{ + content: "", + embeds: [ + { + title: $title, + url: $url, + color: 5814783, + fields: [ + {name: "Repository", value: $repo, inline: true}, + {name: "Tag", value: $tag, inline: true}, + {name: "Release URL", value: $url, inline: false}, + {name: "Release notes", value: $summary, inline: false} + ] + } + ] + }') + + curl -sS -X POST "$DISCORD_WEBHOOK_URL" \ + -H "Content-Type: application/json" \ + -d "$PAYLOAD"