diff --git a/.github/workflows/linux_build_flatpak.yml b/.github/workflows/linux_build_flatpak.yml index 0abd35fba9..5c0f73611d 100644 --- a/.github/workflows/linux_build_flatpak.yml +++ b/.github/workflows/linux_build_flatpak.yml @@ -157,4 +157,21 @@ jobs: with: name: ${{ steps.artifact-metadata.outputs.artifact-name }} path: ci-artifacts + report-error: + runs-on: ubuntu-latest + needs: build_linux + if: always() && needs.build_linux.result == 'failure' && inputs.publish == true + steps: + - uses: actions/checkout@v6 + + - name: Push Discord Webhook + env: + OWNER: PCSX2 + REPO: pcsx2 + DISCORD_BUILD_WEBHOOK: ${{ secrets.DISCORD_BUILD_WEBHOOK }} + GITHUB_TOKEN: ${{ github.token }} + run: | + cd ./.github/workflows/scripts/releases/announce-release + npm ci + FLATHUB_FAILURE=1 node index.js diff --git a/.github/workflows/scripts/releases/announce-release/index.js b/.github/workflows/scripts/releases/announce-release/index.js index 9678980175..a1e57e72d9 100644 --- a/.github/workflows/scripts/releases/announce-release/index.js +++ b/.github/workflows/scripts/releases/announce-release/index.js @@ -38,39 +38,54 @@ const octokit = new Octokit({ } }); -if (process.env.TAG_VAL === undefined || process.env.TAG_VAL === "") { - console.log(`Not announcing - TAG_VAL not defined`); - process.exit(1); +let embed; + +if (process.env.FLATHUB_FAILURE === undefined) +{ + if (process.env.TAG_VAL === undefined || process.env.TAG_VAL === "") { + console.log(`Not announcing - TAG_VAL not defined`); + process.exit(1); + } + + const { data: releaseInfo } = await octokit.rest.repos.getReleaseByTag({ + owner: owner, + repo: repo, + tag: process.env.TAG_VAL, + }); + + if (releaseInfo === undefined) { + console.log(`Not announcing - could not locate release with tag ${process.env.TAG_VAL}`); + process.exit(1); + } + + if (!releaseInfo.prerelease) { + console.log("Not announcing - release was not a pre-release (aka a Nightly)"); + process.exit(0); + } + + // Publish Webhook + embed = new MessageEmbed() + .setColor('#FF8000') + .setTitle('New PCSX2 Nightly Build Available!') + .setDescription("To download the latest or previous builds, [visit the official downloads page](https://pcsx2.net/downloads/).") + .addFields( + { name: 'Version', value: releaseInfo.tag_name, inline: true }, + { name: 'Installation Steps', value: '[See Here](https://pcsx2.net/docs/category/setup)', inline: true }, + { name: 'Included Changes', value: releaseInfo.body, inline: false } + ); + console.log(embed); } +else +{ + // Flathub upload failure -const { data: releaseInfo } = await octokit.rest.repos.getReleaseByTag({ - owner: owner, - repo: repo, - tag: process.env.TAG_VAL, -}); - -if (releaseInfo === undefined) { - console.log(`Not announcing - could not locate release with tag ${process.env.TAG_VAL}`); - process.exit(1); + embed = new MessageEmbed() + .setColor('#FF0000') + .setTitle('PCSX2 Failed to Build/Upload to FlatHub') + .setDescription("Please check the latest Flathub build job to determine the root cause.") + console.log(embed); } -if (!releaseInfo.prerelease) { - console.log("Not announcing - release was not a pre-release (aka a Nightly)"); - process.exit(0); -} - -// Publish Webhook -const embed = new MessageEmbed() - .setColor('#FF8000') - .setTitle('New PCSX2 Nightly Build Available!') - .setDescription("To download the latest or previous builds, [visit the official downloads page](https://pcsx2.net/downloads/).") - .addFields( - { name: 'Version', value: releaseInfo.tag_name, inline: true }, - { name: 'Installation Steps', value: '[See Here](https://pcsx2.net/docs/category/setup)', inline: true }, - { name: 'Included Changes', value: releaseInfo.body, inline: false } - ); -console.log(embed); - // Get all webhooks, simple comma-sep string const webhookUrls = process.env.DISCORD_BUILD_WEBHOOK.split(",");