From 08216327f15b4fd1c8a10345e87e8142dfd8f949 Mon Sep 17 00:00:00 2001 From: Christian Zunker Date: Thu, 19 Dec 2024 08:54:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20Migrate=20from=20Discord=20to=20?= =?UTF-8?q?Slack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian Zunker --- .github/workflows/gh-release.yaml | 59 ++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/.github/workflows/gh-release.yaml b/.github/workflows/gh-release.yaml index 8199f0b..9515ac4 100644 --- a/.github/workflows/gh-release.yaml +++ b/.github/workflows/gh-release.yaml @@ -1,4 +1,4 @@ -name: Create GitHub Release +name: Create packer-plugin-cnspec GitHub Release ## Only trigger release when the VERSION file changed on main branch on: @@ -9,13 +9,36 @@ on: - main workflow_dispatch: +env: + # C07QZDJFF89 == #release-coordination + SLACK_BOT_CHANNEL_ID: "C07QZDJFF89" + jobs: create-gh-release: name: GH Release permissions: contents: write runs-on: ubuntu-latest + outputs: + update-ts: ${{ steps.slack.outputs.ts }} steps: + - id: slack + uses: slackapi/slack-github-action@v2.0.0 + with: + method: chat.postMessage + token: ${{ secrets.SLACK_BOT_TOKEN }} + payload: | + channel: "${{ env.SLACK_BOT_CHANNEL_ID }}" + text: "GitHub Actions Run" + attachments: + - color: "#FFFF00" + blocks: + - type: "section" + fields: + - type: "mrkdwn" + text: "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>" + - type: "mrkdwn" + text: "*Status:*\n`In Progress`" - name: Checkout uses: actions/checkout@v4 - name: Set release version @@ -47,19 +70,23 @@ jobs: retry_on: error # error on HTTP code different to 302 command: curl -o /dev/null -s -w "%{http_code}\n" "https://github.com/mondoohq/packer-plugin-cnspec/releases/download/${{ env.RELEASE_VERSION }}/packer-plugin-cnspec_${{ env.RELEASE_VERSION }}_SHA256SUMS" | grep 302 - - uses: sarisia/actions-status-discord@v1 - if : ${{ always() && steps.check_release_file.outputs.status == 'failure' }} - with: - webhook: ${{ secrets.DISCORD_WEBHOOK }} - status: ${{ steps.check_release_file.outputs.status }} - url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - description: Workflow ${{ github.workflow }} for ${{ env.RELEASE_VERSION }} failed - color: 0xff4d4d - - uses: sarisia/actions-status-discord@v1 - if : ${{ always() && steps.check_release_file.outputs.status == 'success' }} + - uses: slackapi/slack-github-action@v2.0.0 + if : ${{ always() }} with: - webhook: ${{ secrets.DISCORD_WEBHOOK }} - status: ${{ steps.check_release_file.outputs.status }} - url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} - description: Workflow ${{ github.workflow }} for ${{ env.RELEASE_VERSION }} succeeded - color: 0x5dea20 \ No newline at end of file + method: chat.update + token: ${{ secrets.SLACK_BOT_TOKEN }} + payload: | + channel: "${{ env.SLACK_BOT_CHANNEL_ID }}" + ts: "${{ jobs.create-gh-release.outputs.update-ts }}" + text: "GitHub Actions Run" + attachments: + - color: "${{ (steps.check_release_file.outputs.status == 'success') && '#00FF00' || (steps.check_release_file.outputs.status == 'failure') && '#FF0000' || '#FFA500' }}" + blocks: + - type: "section" + fields: + - type: "mrkdwn" + text: "<${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}|${{ github.workflow }}>" + - type: "mrkdwn" + text: " " + - type: "mrkdwn" + text: "*Status:*\n`${{ steps.check_release_file.outputs.status }}`" \ No newline at end of file