From 7e27ae8ac2c8d42eed77de63dc2fb8956d33d597 Mon Sep 17 00:00:00 2001 From: Ryan Hullah Date: Tue, 5 Dec 2023 22:37:50 -0500 Subject: [PATCH 1/2] add release Discord notification Add an on-publish step to send a Discord notification when a release is published. Additionally format the args a little nicer and remove the redundant expression syntax on `if:`. --- .github/workflows/discord.yml | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/workflows/discord.yml b/.github/workflows/discord.yml index 3b1619fe8bf..21213452178 100644 --- a/.github/workflows/discord.yml +++ b/.github/workflows/discord.yml @@ -1,26 +1,45 @@ name: Discord notifications on: + release: + types: + - published workflow_run: - workflows: ["ContinuousIntegration", "Build and Publish", "Build and publish multiarch" ] + workflows: ["Build and Publish"] types: - completed env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} jobs: discord: runs-on: ubuntu-latest timeout-minutes: 5 steps: + - name: on-publish + if: github.event_name == 'release' && github.event.action == 'published' + uses: Ilshidur/action-discord@master + with: + args: | + Github repo: [${{ github.repository }}](<${{ github.event.repository.html_url}}>) + Release: [${{ github.event.release.name }}](<${{ github.event.release.html_url }}>) + ${{ github.event.release.body }} - name: on-success - if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: github.event.workflow_run.conclusion == 'success' uses: Ilshidur/action-discord@master with: - args: "Github repo: ${{ github.repository }}\n- Branch: ${{ github.event.workflow_run.head_branch }}\n- [Link: to Actions](<${{ github.event.workflow_run.html_url }}>)\n- Status: 🎉 ${{ github.event.workflow_run.conclusion }} 🍏" + args: | + Github repo: ${{ github.repository }} + - Branch: ${{ github.event.workflow_run.head_branch }} + - [Link: to Actions](<${{ github.event.workflow_run.html_url }}>) + - Status: 🎉 ${{ github.event.workflow_run.conclusion }} 🍏 - name: on-failure - if: ${{ github.event.workflow_run.conclusion == 'failure' }} + if: github.event.workflow_run.conclusion == 'failure' uses: Ilshidur/action-discord@master with: - args: "Github repo: ${{ github.repository }}\n- Branch: ${{ github.event.workflow_run.head_branch }}\n- [Link: to Actions](<${{ github.event.workflow_run.html_url }}>)\n- Status: 🤔 ${{ github.event.workflow_run.conclusion }} 💣💥" + args: | + Github repo: ${{ github.repository }} + - Branch: ${{ github.event.workflow_run.head_branch }} + - [Link: to Actions](<${{ github.event.workflow_run.html_url }}>) + - Status: 🤔 ${{ github.event.workflow_run.conclusion }} 💣💥 From 93e5d099db0eb0f8229721688ad0d0dda577b738 Mon Sep 17 00:00:00 2001 From: Ryan Hullah Date: Tue, 5 Dec 2023 22:41:25 -0500 Subject: [PATCH 2/2] fix YAML indentation --- .github/workflows/discord.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/discord.yml b/.github/workflows/discord.yml index 21213452178..3b7ea295aee 100644 --- a/.github/workflows/discord.yml +++ b/.github/workflows/discord.yml @@ -10,7 +10,7 @@ on: - completed env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} jobs: discord: @@ -21,10 +21,10 @@ jobs: if: github.event_name == 'release' && github.event.action == 'published' uses: Ilshidur/action-discord@master with: - args: | - Github repo: [${{ github.repository }}](<${{ github.event.repository.html_url}}>) - Release: [${{ github.event.release.name }}](<${{ github.event.release.html_url }}>) - ${{ github.event.release.body }} + args: | + Github repo: [${{ github.repository }}](<${{ github.event.repository.html_url}}>) + Release: [${{ github.event.release.name }}](<${{ github.event.release.html_url }}>) + ${{ github.event.release.body }} - name: on-success if: github.event.workflow_run.conclusion == 'success' uses: Ilshidur/action-discord@master