diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4a3cc0e8a..cb1f35baa 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -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 diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml new file mode 100644 index 000000000..3c1cde438 --- /dev/null +++ b/.github/workflows/notify.yml @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6c36b7074..5059c0690 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/.github/workflows/smoke.yml b/.github/workflows/smoke.yml index 11e2f295c..be9c575f3 100644 --- a/.github/workflows/smoke.yml +++ b/.github/workflows/smoke.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 26ef827d9..3f61a7822 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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