2021-10-18 04:15:45 +00:00
|
|
|
import { MessageEmbed, WebhookClient } from "discord.js";
|
|
|
|
import * as github from '@actions/github';
|
|
|
|
|
2021-11-23 01:02:18 +00:00
|
|
|
const releaseInfo = github.context.payload.release;
|
|
|
|
|
|
|
|
if (!releaseInfo.prerelease) {
|
|
|
|
console.log("Not announcing - release was not a pre-release (aka a Nightly)");
|
|
|
|
process.exit(0);
|
|
|
|
}
|
|
|
|
|
2021-10-18 04:15:45 +00:00
|
|
|
// Publish Webhook
|
|
|
|
const embed = new MessageEmbed()
|
|
|
|
.setColor('#FF8000')
|
|
|
|
.setTitle('New PCSX2 Nightly Build Available!')
|
2022-03-31 00:29:51 +00:00
|
|
|
.setDescription("To download the latest or previous builds, [visit the official downloads page](https://pcsx2.net/downloads/).")
|
2021-10-18 04:15:45 +00:00
|
|
|
.addFields(
|
2021-11-23 01:02:18 +00:00
|
|
|
{ name: 'Version', value: releaseInfo.tag_name, inline: true },
|
2021-11-03 23:42:14 +00:00
|
|
|
{ name: 'Installation Steps', value: '[See Here](https://github.com/PCSX2/pcsx2/wiki/Nightly-Build-Usage-Guide)', inline: true },
|
2022-03-31 00:29:51 +00:00
|
|
|
{ name: 'Included Changes', value: releaseInfo.body, inline: false }
|
2021-10-18 04:15:45 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
const webhookClient = new WebhookClient({ url: process.env.DISCORD_BUILD_WEBHOOK });
|
|
|
|
await webhookClient.send({
|
|
|
|
embeds: [embed],
|
|
|
|
});
|