-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
actions: Create script to announce a new release via a Discord WebHooks
- Loading branch information
1 parent
6eacade
commit c32d5f1
Showing
4 changed files
with
864 additions
and
0 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
.github/workflows/scripts/releases/announce-release/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/ | ||
*.md |
40 changes: 40 additions & 0 deletions
40
.github/workflows/scripts/releases/announce-release/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { MessageEmbed, WebhookClient } from "discord.js"; | ||
import * as github from '@actions/github'; | ||
|
||
const assets = github.context.payload.release.assets; | ||
let windowsAssetLinks = ""; | ||
let linuxAssetLinks = ""; | ||
|
||
for (var i = 0; i < assets.length; i++) { | ||
let asset = assets[i]; | ||
if (asset.name.includes("symbols")) { | ||
continue; | ||
} | ||
if (asset.name.includes("windows")) { | ||
windowsAssetLinks += `- [${asset.name}](${asset.browser_download_url})\n` | ||
} else if (asset.name.includes("linux")) { | ||
linuxAssetLinks += `- [${asset.name}](${asset.browser_download_url})\n` | ||
} | ||
} | ||
|
||
// Publish Webhook | ||
const embed = new MessageEmbed() | ||
.setColor('#FF8000') | ||
.setTitle('New PCSX2 Nightly Build Available!') | ||
.addFields( | ||
{ name: 'Version', value: github.context.payload.release.tag_name, inline: true }, | ||
{ name: 'Release Link', value: `[Github Release](${github.context.payload.release.html_url})`, inline: true }, | ||
{ name: 'Installation Steps', value: '[See Here](https://github.com/PCSX2/pcsx2/wiki/Nightly-Build-Usage-Guide)', inline: true } | ||
); | ||
|
||
if (windowsAssetLinks != "") { | ||
embed.addField('Windows Downloads', windowsAssetLinks, false); | ||
} | ||
if (linuxAssetLinks != "") { | ||
embed.addField('Linux Downloads', linuxAssetLinks, false); | ||
} | ||
|
||
const webhookClient = new WebhookClient({ url: process.env.DISCORD_BUILD_WEBHOOK }); | ||
await webhookClient.send({ | ||
embeds: [embed], | ||
}); |
Oops, something went wrong.