Skip to content

ReStreet: FIFA Street (2012) recompiled for Windows PC, with online play, a launcher with friends, chat and rooms. Bring your own game.

Add Discord release announcement workflow

SamuelitoDaVilac3733ad81f38
diff --git a/.github/workflows/discord-release.yml b/.github/workflows/discord-release.yml
new file mode 100644
index 0000000..cd0a032
--- /dev/null
+++ b/.github/workflows/discord-release.yml
@@ -0,0 +1,49 @@
+# Posts every published release to Discord and pings the @Releases role.
+# Setup (once):
+# Settings > Secrets and variables > Actions
+# - Secret DISCORD_RELEASE_WEBHOOK = webhook URL of the #github-releases channel
+# - Variable DISCORD_RELEASES_ROLE_ID = ID of the @Releases role
+name: Discord release announcement
+
+on:
+ release:
+ types: [published]
+
+jobs:
+ announce:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Post release to Discord
+ env:
+ WEBHOOK: ${{ secrets.DISCORD_RELEASE_WEBHOOK }}
+ ROLE_ID: ${{ vars.DISCORD_RELEASES_ROLE_ID }}
+ NAME: ${{ github.event.release.name }}
+ TAG: ${{ github.event.release.tag_name }}
+ URL: ${{ github.event.release.html_url }}
+ BODY: ${{ github.event.release.body }}
+ run: |
+ if [ -z "$WEBHOOK" ]; then
+ echo "DISCORD_RELEASE_WEBHOOK secret is not set"
+ exit 1
+ fi
+ MENTION=""
+ if [ -n "$ROLE_ID" ]; then MENTION="<@&$ROLE_ID> New update is out!"; fi
+ DESC=$(printf '%s' "$BODY" | head -c 3500)
+ jq -n \
+ --arg content "$MENTION" \
+ --arg role "$ROLE_ID" \
+ --arg title "${NAME:-$TAG}" \
+ --arg url "$URL" \
+ --arg desc "$DESC" \
+ --arg tag "$TAG" \
+ '{
+ content: $content,
+ allowed_mentions: { roles: (if $role == "" then [] else [$role] end) },
+ embeds: [{
+ title: $title,
+ url: $url,
+ description: ($desc + "\n\n**Download:** " + $url),
+ color: 15844367,
+ footer: { text: $tag }
+ }]
+ }' | curl -fsS -H "Content-Type: application/json" -d @- "$WEBHOOK"