Skip to content

Commit 6e8b573

Browse files
committed
Workflow: Add slack notification upon release published
1 parent 9bad497 commit 6e8b573

File tree

3 files changed

+73
-3
lines changed

3 files changed

+73
-3
lines changed

.github/workflows/build-push.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: build preview
22

33
on:
4-
release:
5-
types:
6-
- published
74
pull_request:
85
branches:
96
- "*"

.github/workflows/release-build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Build preview on documentation repo upon release publish
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
env:
9+
OWNER: nginx
10+
REPO: nginx-hugo-theme
11+
12+
jobs:
13+
trigger-documentation-build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Trigger 'Build and deploy' workflow in 'documentation' repo
17+
run: |
18+
curl -L \
19+
-X POST \
20+
-H "Accept: application/vnd.github+json" \
21+
-H "Authorization: Bearer ${{ secrets.F5_CLA_TOKEN }}" \
22+
-H "X-GitHub-Api-Version: 2022-11-28" \
23+
"https://api.github.com/repos/${{ env.OWNER }}/${{ env.REPO }}/dispatches" \
24+
-d "{"event_type": "trigger-preview-build", "client_payload": {"environment": "preview", "hugo_theme_override": "", "author": "${{ github.event.release.author }}", "tag_name": "${{ github.event.release.tag_name }}", "release_name": "${{ github.event.release.name }}"}}"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Slack notification for new theme release
2+
3+
on:
4+
repository_dispatch:
5+
types: [trigger-slack-notification]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
release-notification:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
actions: read # for 8398a7/action-slack
16+
checks: read
17+
steps:
18+
- name: Send notification
19+
uses: 8398a7/action-slack@1750b5085f3ec60384090fb7c52965ef822e869e # v3.18.0
20+
with:
21+
status: custom
22+
custom_payload: |
23+
{
24+
username: 'Github',
25+
mention: 'channel',
26+
attachments: [{
27+
title: `New theme release - ${{ github.event.client_payload.release_name }}`,
28+
color: '#009223',
29+
fields: [
30+
{
31+
title: 'Tag',
32+
value: ${{ github.event.client_payload.tag_name }},
33+
short: true
34+
},
35+
{
36+
title: 'Author',
37+
value: ${{ github.event.client_payload.author }},
38+
short: true
39+
},
40+
{
41+
title: 'Preview URL',
42+
value: ${{ github.event.client_payload.previewURL }},
43+
short: true
44+
}]
45+
}]
46+
}
47+
env:
48+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
49+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}

0 commit comments

Comments
 (0)