From edc17ead065240727a66f301e0a142130035ee4d Mon Sep 17 00:00:00 2001 From: Zane Selvans Date: Sat, 16 Sep 2023 01:07:28 -0600 Subject: [PATCH] Notiy Slack on new release. --- .github/workflows/release.yml | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d56bf06e..42a2d0fe 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,7 +28,7 @@ jobs: path: dist/ pypi-publish: - name: Upload release to Test PyPI + name: Upload release to PyPI if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') needs: - build @@ -72,3 +72,29 @@ jobs: gh release create '${{ github.ref_name }}' ./dist/*.tar.gz ./dist/*.whl --generate-notes --repo '${{ github.repository }}' + + release-notify: + runs-on: ubuntu-latest + needs: + - github-publish + if: ${{ always() }} + steps: + - name: Inform the Codemonkeys + uses: 8398a7/action-slack@v3 + continue-on-error: true + with: + status: custom + fields: workflow,job,commit,repo,ref,author,took + custom_payload: | + { + username: 'action-slack', + icon_emoji: ':octocat:', + attachments: [{ + color: '${{ needs.github-publish.result }}' === 'success' ? 'good' : '${{ needs.github-publish.result }}' === 'failure' ? 'danger' : 'warning', + text: `${process.env.AS_REPO}@${process.env.AS_REF}\n ${process.env.AS_WORKFLOW} (${process.env.AS_COMMIT})\n by ${process.env.AS_AUTHOR}\n Status: ${{ needs.github-publish.result }}`, + }] + } + env: + GITHUB_TOKEN: ${{ github.token }} # required + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required + MATRIX_CONTEXT: ${{ toJson(matrix) }} # required