Skip to content

Commit

Permalink
Merge #4088 Consolidate Discord notification steps
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed May 19, 2024
2 parents b7a1c93 + 897fde5 commit e00cf14
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 59 deletions.
21 changes: 5 additions & 16 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,25 +188,14 @@ jobs:
./build docker-metadata --configuration=Release --exclusive
notify-discord:
runs-on: ubuntu-latest
needs:
- upload-deb
- upload-rpm
- upload-inflator
- upload-metadata-tester
env:
JOB_STATUS: failure
if: always()
steps:
- name: Set Success
run: echo "JOB_STATUS=success" >> $GITHUB_ENV
if: contains(needs.*.result, 'failure') == false
- name: Send Discord Notification
env:
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: env.WEBHOOK_URL
run: |
git clone --depth 1 https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
uses: ./.github/workflows/notify.yml
with:
name: ${{ github.workflow }}
success: ${{ !contains(needs.*.result, 'failure') }}
secrets: inherit
26 changes: 26 additions & 0 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Send Discord Notification

on:
workflow_call:
inputs:
name:
type: string
required: true
success:
type: boolean
required: true
secrets:
DISCORD_WEBHOOK:
required: true

jobs:
notify:
runs-on: ubuntu-latest
steps:
- env:
WORKFLOW_NAME: ${{ inputs.name }}
HOOK_OS_NAME: ${{ runner.os }}
shell: bash
run: |
git clone --depth 1 https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh ${{ inputs.success && 'success' || 'failure' }} ${{ secrets.DISCORD_WEBHOOK }}
21 changes: 5 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -181,26 +181,15 @@ jobs:
run: gh release upload ${{ github.event.release.tag_name }} _build/repack/Release/AutoUpdater.exe

notify-discord:
runs-on: ubuntu-latest
needs:
- build-dmg
- build-deb
- build-rpm
- upload-binaries
- upload-nuget
env:
JOB_STATUS: failure
if: always()
steps:
- name: Set Success
run: echo "JOB_STATUS=success" >> $GITHUB_ENV
if: contains(needs.*.result, 'failure') == false
- name: Send Discord Notification
env:
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: env.WEBHOOK_URL
run: |
git clone --depth 1 https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
uses: ./.github/workflows/notify.yml
with:
name: ${{ github.workflow }}
success: ${{ !contains(needs.*.result, 'failure') }}
secrets: inherit
19 changes: 6 additions & 13 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,11 @@ jobs:
"
notify:
needs:
- build-release
- smoke-test-inflator
runs-on: ubuntu-latest
if: failure()
steps:
- name: Send Discord Notification
env:
JOB_STATUS: failure
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: env.WEBHOOK_URL
run: |
git clone https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
shell: bash
uses: ./.github/workflows/notify.yml
with:
name: ${{ github.workflow }}
success: ${{ !contains(needs.*.result, 'failure') }}
secrets: inherit
19 changes: 6 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,11 @@ jobs:

notify:
needs:
- build-debug
- test-build
runs-on: ubuntu-latest
if: failure()
steps:
- name: Send Discord Notification
env:
JOB_STATUS: failure
WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK }}
HOOK_OS_NAME: ${{ runner.os }}
WORKFLOW_NAME: ${{ github.workflow }}
if: env.WEBHOOK_URL
run: |
git clone https://github.com/DiscordHooks/github-actions-discord-webhook.git webhook
bash webhook/send.sh $JOB_STATUS $WEBHOOK_URL
shell: bash
uses: ./.github/workflows/notify.yml
with:
name: ${{ github.workflow }}
success: ${{ !contains(needs.*.result, 'failure') }}
secrets: inherit
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ All notable changes to this project will be documented in this file.
- [Multiple] Build nuget package, support netstandard2.0 build (#4039 by: HebaruSan)
- [Core] Use fully sanitized archive.org bucket names (#4043 by: HebaruSan)
- [Netkan] Omit duplicate inflation warnings in queue (#4071 by: HebaruSan)
- [Build] Refactor + Modernise Actions (#4082 by: techman83; reviewed: HebaruSan)
- [Build] Refactor + Modernise Actions (#4082, #4088 by: techman83, HebaruSan; reviewed: HebaruSan)

## v1.34.4 (Niven)

Expand Down

0 comments on commit e00cf14

Please sign in to comment.