Northstar icon indicating copy to clipboard operation
Northstar copied to clipboard

Automatic releases for release candidates in designated Discord channel

Open GeckoEidechse opened this issue 2 years ago • 5 comments

It would be nice if we could set up a way that automatically posts release candidates to a designated Discord channel in Northstar Discord, upon build.

This would streamline our testing workflow a lot, as currently one needs to manually upload release builds to a channel.

GeckoEidechse avatar Jun 17 '22 23:06 GeckoEidechse

@p0358 what's the hook/bot you currently use to publish r1o releases? ^^

GeckoEidechse avatar Jun 17 '22 23:06 GeckoEidechse

it's a custom-written script in PowerShell since no existing actions were good enough for what we wanted, I can share it when the author agrees (so when he wakes up) (not that it's not gonna be open source eventually anways xD)

p0358 avatar Jun 17 '22 23:06 p0358

Sending build itself is

      - id: DiscordSendArtifacts
        if: success()
        name: Send build to Discord
        run: ./.github/discord-webhook-file.ps1 ${{ env.ARTIFACTS_PATH }}
        env:
          CI_NUM: ${{ matrix.target }}#${{ github.run_number }}

The script

param ($file_path)
$EXT_WHITELIST = "*.exe", "*.dll"
if ($DISCORD_HOOK -isnot [string]) {
    $DISCORD_HOOK = $env:DISCORD_HOOK
}
$DiscordArgs = @{}
$DiscordArgs.Add("username", "GitHub Actions")
$DiscordArgs.Add("avatar_url", "https://raw.githubusercontent.com/github/explore/2c7e603b797535e5ad8b4beb575ab3b7354666e1/topics/actions/actions.png")
# $DiscordArgs.Add("content", "`u{2705}CI Run $env:CI_NUM was a success!")
$DiscordArgs.Add("file1", $(Compress-Archive -Path $(Get-ChildItem -Path $file_path -Recurse -Include $EXT_WHITELIST) -PassThru -DestinationPath $env:FILE_NAME))
Invoke-RestMethod -Uri "$($DISCORD_HOOK)?wait=true" -Method Post -form $DiscordArgs -ContentType "multipart/form-data"

written by @OctoNezd

goes without saying you need to supply the env variables:

  • DISCORD_HOOK
  • ARTIFACTS_PATH

It does on the fly compress the whitelisted extensions from specified dir and uploads that zip file to the channel where the webhook is attached to

p0358 avatar Jun 18 '22 03:06 p0358

The scripts to send and edit build status message are separate, as is combining the artifacts for packaging later in the package repo

p0358 avatar Jun 18 '22 03:06 p0358

Its not exactly on fly - Compress-Archive always creates zip file. The environment variable FILE_NAME must be specified too iirc.

OctoNezd avatar Jun 18 '22 10:06 OctoNezd

Related: https://github.com/CooldudePUGS/Spectre/issues/33

GeckoEidechse avatar Aug 11 '23 11:08 GeckoEidechse

Related: itscynxx/Spectre#33

This issue has since been closed as Spectre has support for pinging playtesters now. It can be manually updated by command if something goes wrong, Spectre simply doesn't have perms to ping playtester (which Gecko usually pings them)

Related Spectre pull request: https://github.com/itscynxx/Spectre/pull/44

itscynxx avatar Jan 17 '24 19:01 itscynxx

Yeah, basically between FlightCore supporting release candidates as a release channel and Spectre being able to ping playtesters I'd say this issue can be closed as completed :D

GeckoEidechse avatar Jan 17 '24 20:01 GeckoEidechse