|
6 | 6 | - post-release |
7 | 7 | # Client payload should contain |
8 | 8 | # version_name: vX.Y.Z (with prefix) |
9 | | - # slack_thread_id: (Also named thread_ts == thread timestamp) |
| 9 | + # slack_thread_id: (Also named thread_ts == thread timestamp == timestamp of the first message) |
10 | 10 | permissions: |
11 | 11 | contents: write |
12 | 12 |
|
|
21 | 21 | organization: Giskard-AI |
22 | 22 | username: ${{ github.actor }} |
23 | 23 | token: ${{ secrets.GITHUB_TOKEN }} |
| 24 | + |
24 | 25 | - name: Interrupt job |
25 | 26 | if: ${{ steps.is_organization_member.outputs.result == 'false' }} |
26 | 27 | shell: bash |
@@ -106,23 +107,36 @@ jobs: |
106 | 107 | - name: Push to Pipy |
107 | 108 | run: pdm publish --no-build --username "${{ secrets.PIPY_USERNAME }}" --password "${{ secrets.PIPY_PASSWORD }}" |
108 | 109 |
|
| 110 | + - name: Set job success env var |
| 111 | + run: | |
| 112 | + echo "JOB_SUCCESS=true" >> $GITHUB_ENV |
| 113 | +
|
109 | 114 | - name: Post Slack message |
| 115 | + # # cancellable always() https://docs.github.com/en/actions/learn-github-actions/expressions#status-check-functions |
| 116 | + if: !cancelled() |
110 | 117 | id: slack |
111 | 118 | uses: slackapi/slack-github-action@v1.24.0 |
| 119 | + env: |
| 120 | + SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
| 121 | + ON_SUCCESS: | |
| 122 | + <!channel> |
| 123 | + Release **${{ env.VERSION_NAME }}** has been published ! :tada: |
| 124 | + [Release notes](${{ steps.github-release.outputs.url }}) | [PyPI](https://pypi.org/project/giskard/${{ env.VERSION_NUMBER }}) |
| 125 | + Github releases: \ |
| 126 | + [Library](${{ github.server_url }}/${{ github.repository_owner }}/giskard/releases/tag/${{ env.VERSION_NUMBER }}) | \ |
| 127 | + [Hub](${{ github.server_url }}/${{ github.repository_owner }}/giskard-hub/releases/tag/${{ env.VERSION_NUMBER }}) |
| 128 | + ON_FAILURE: | |
| 129 | + "<!channel> Release ${{ env.VERSION_NAME }} failed on post-release :cross: |
| 130 | + [Logs](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) |
112 | 131 | with: |
113 | 132 | # Slack channel id, channel name, or user id to post message. |
114 | 133 | # See also: https://api.slack.com/methods/chat.postMessage#channels |
115 | 134 | # On special mentions: https://api.slack.com/reference/surfaces/formatting#special-mentions |
116 | 135 | channel-id: ${{ vars.SLACK_CHANNEL_ID }} |
117 | | - slack-message: | |
118 | | - <!channel> New library release: ${{ env.VERSION_NAME }} :tada: |
119 | | - [Release notes](${{ steps.github-release.outputs.url }}) | [PyPI](https://pypi.org/project/giskard/${{ env.VERSION_NUMBER }}) |
| 136 | + slack-message: ${{ env.JOB_SUCCESS == 'true' && env.ON_SUCCESS || env.ON_FAILURE }} |
120 | 137 | # reploy_broadcast == also send to channel |
121 | 138 | payload: | |
122 | 139 | { |
123 | 140 | "thread_ts": "${{ inputs.slack_thread_id }}", |
124 | 141 | "reply_broadcast": true |
125 | 142 | } |
126 | | - # For posting a rich message using Block Kit |
127 | | - env: |
128 | | - SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
|
0 commit comments