Skip to content

Commit 45b736f

Browse files
committed
some light discord spam
1 parent 7382056 commit 45b736f

1 file changed

Lines changed: 49 additions & 17 deletions

File tree

.github/workflows/ov_build_release_shared.yaml

Lines changed: 49 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,24 @@ jobs:
364364
if: env.vv_enabled == 'true'
365365
run: msbuild src/VVCustom.sln /NoLogo /Verbosity:minimal /p:Configuration=Release /p:Platform=${{ env.platform }} /m /p:PreferredToolArchitecture=x64
366366

367+
- name: "[Notify] Discord build SHAs"
368+
if: success() && secrets.MQDISCORD_BUILD_SHA_WEBHOOK != ''
369+
shell: pwsh
370+
env:
371+
MQDISCORD_BUILD_SHA_WEBHOOK: ${{ secrets.MQDISCORD_BUILD_SHA_WEBHOOK }}
372+
run: |
373+
$shaVV = git rev-parse --short HEAD
374+
$shaEqlib = git -C src/eqlib rev-parse --short HEAD
375+
$shaCWTN = if (Test-Path plugins/CWTN) { git -C plugins/CWTN rev-parse --short HEAD } else { 'n/a' }
376+
$desc = "**eqlib** $shaEqlib`n**vv** $shaVV`n**cwtn** $shaCWTN"
377+
$embed = [PSCustomObject]@{
378+
title = "${{ inputs.client_target }} build ${{ github.run_number }}"
379+
description = $desc
380+
}
381+
$payload = [PSCustomObject]@{ embeds = @($embed) } | ConvertTo-Json -Depth 6
382+
Invoke-RestMethod -Uri $env:MQDISCORD_BUILD_SHA_WEBHOOK -Method Post -Body $payload -ContentType 'application/json'
383+
continue-on-error: true
384+
367385
- name: "[Symbols] Update Symbol Server"
368386
shell: pwsh
369387
run: |
@@ -562,23 +580,6 @@ jobs:
562580
run: |
563581
gh release create ${{ github.ref_name }} --title "MacroQuest (${{ inputs.client_target }}) v$($env:MQVERSION_INFO)" --notes-file "${{ github.workspace }}/build/ReleaseNotes.md" ${{ env.gh_release_flag }} build/bin/MacroQuest.zip
564582
565-
- name: "[Release] Send Discord Notice"
566-
if: false # disabled while iterating on the workflow
567-
shell: pwsh
568-
run: |
569-
[System.Collections.ArrayList]$embedArray = @()
570-
$embedObject = [PSCustomObject]@{
571-
color = "4289797"
572-
title = "New MacroQuest (${{ inputs.client_target }}) Build $($env:MQVERSION_INFO)"
573-
description = "Build has been uploaded to: https://github.com/${{ github.repository }}/releases/tag/$($env:GITHUB_REF_NAME)"
574-
}
575-
$embedArray.Add($embedObject) | Out-Null
576-
$discordPayload = [PSCustomObject]@{
577-
embeds = $embedArray
578-
} | ConvertTo-Json
579-
Invoke-RestMethod -Uri '${{ secrets.MQDISCORD_WEBHOOK }}' -Method Post -Body $discordPayload -ContentType 'application/json'
580-
continue-on-error: true
581-
582583
- name: "[Release] Publish to RedGuides"
583584
if: env.vv_enabled == 'true'
584585
shell: pwsh
@@ -632,3 +633,34 @@ jobs:
632633
contentType: application/x-www-form-urlencoded
633634
data: key=${{ secrets.READY_UPDATE_KEY }}&${{ inputs.client_target }}=yes
634635
timeout: 60000
636+
637+
- name: "[Notify] Discord completion"
638+
if: success() && secrets.MQDISCORD_DEV_WEBHOOK != ''
639+
shell: pwsh
640+
env:
641+
MQDISCORD_DEV_WEBHOOK: ${{ secrets.MQDISCORD_DEV_WEBHOOK }}
642+
run: |
643+
$runUrl = "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
644+
$embed = [PSCustomObject]@{
645+
title = "${{ github.run_number }} Complete"
646+
description = "**${{ inputs.client_target }}** and its cargo of symbols have arrived unharmed.`n[View run]($runUrl)"
647+
}
648+
$payload = [PSCustomObject]@{ embeds = @($embed) } | ConvertTo-Json -Depth 6
649+
Invoke-RestMethod -Uri $env:MQDISCORD_DEV_WEBHOOK -Method Post -Body $payload -ContentType 'application/json'
650+
continue-on-error: true
651+
652+
- name: "[Notify] Discord build failure"
653+
if: failure() && secrets.MQDISCORD_DEV_WEBHOOK != ''
654+
shell: pwsh
655+
env:
656+
MQDISCORD_DEV_WEBHOOK: ${{ secrets.MQDISCORD_DEV_WEBHOOK }}
657+
run: |
658+
$runUrl = "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
659+
$embed = [PSCustomObject]@{
660+
color = 15548997
661+
title = "Pipeline Failed: ${{ github.run_number }}"
662+
description = "**${{ inputs.client_target }}** isn't going to make it.`n[View run]($runUrl)"
663+
}
664+
$payload = [PSCustomObject]@{ embeds = @($embed) } | ConvertTo-Json -Depth 6
665+
Invoke-RestMethod -Uri $env:MQDISCORD_DEV_WEBHOOK -Method Post -Body $payload -ContentType 'application/json'
666+
continue-on-error: true

0 commit comments

Comments
 (0)