Skip to content

Commit c7221de

Browse files
committed
ci: add slack announce on release
1 parent fcd778d commit c7221de

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/announce.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
on:
2+
release:
3+
types:
4+
- published
5+
jobs:
6+
slack:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
webhook: ${{ fromJSON(secrets.SLACK_WEBHOOKS) }}
11+
steps:
12+
- name: Get tag
13+
id: get_tag
14+
run: echo ::set-output name=TAG::${GITHUB_REF/refs\/tags\//}
15+
- name: Get version
16+
id: get_version
17+
run: echo ::set-output name=VERSION::${TAG##v}
18+
env:
19+
TAG: ${{ steps.get_tag.outputs.TAG }}
20+
- name: Prepare message
21+
id: get_message
22+
run: echo ::set-output name=MSG::"${{ secrets.SLACK_MESSAGE }}"
23+
env:
24+
VERSION: ${{ steps.get_version.outputs.VERSION }}
25+
TAG: ${{ steps.get_tag.outputs.TAG }}
26+
RELEASE_URL: "https://github.com/scaleway/terraform-provider-scaleway/releases/tag/${{ steps.get_tag.outputs.TAG }}"
27+
- name: Announce on slack
28+
id: announce_slack
29+
run: |
30+
curl -X POST -H 'Content-type: application/json' \
31+
--data '{
32+
"blocks": [
33+
{
34+
"type": "section",
35+
"text": {
36+
"type": "mrkdwn",
37+
"text": "'"${MESSAGE}"'"
38+
}
39+
}
40+
]
41+
}' \
42+
${WEBHOOK_URL}
43+
env:
44+
WEBHOOK_URL: ${{ matrix.webhook }}
45+
MESSAGE: ${{ steps.get_message.outputs.MSG }}

0 commit comments

Comments
 (0)