Skip to content

Add slack notification upon release published #260

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
name: build preview

on:
release:
types:
- published
pull_request:
branches:
- "*"
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build preview on documentation repo upon release publish

on:
release:
types:
- published

env:
OWNER: nginx
REPO: documentation

jobs:
trigger-documentation-build:
runs-on: ubuntu-latest
steps:
- name: Trigger 'Build and deploy' workflow in 'documentation' repo
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.DOCUMENTATION_SLACK_FLOW_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ env.OWNER }}/${{ env.REPO }}/dispatches" \
-d "{\"event_type\": \"trigger-preview-build\", \"client_payload\": {\"environment\": \"preview\", \"hugo_theme_override\": \"\", \"author\": \"${{ github.event.release.author.login }}\", \"tag_name\": \"${{ github.event.release.tag_name }}\", \"release_name\": \"${{ github.event.release.name }}\"}}"
49 changes: 49 additions & 0 deletions .github/workflows/slack-notification.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Slack notification for new theme release

on:
repository_dispatch:
types: [trigger-slack-notification]

permissions:
contents: read

jobs:
release-notification:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read # for 8398a7/action-slack
checks: read
steps:
- name: Send notification
uses: 8398a7/action-slack@1750b5085f3ec60384090fb7c52965ef822e869e # v3.18.0
with:
status: custom
custom_payload: |
{
username: 'Github',
mention: 'channel',
attachments: [{
title: `New theme release - ${{ github.event.client_payload.release_name }}`,
color: '#009223',
fields: [
{
title: 'Tag',
value: ${{ github.event.client_payload.tag_name }},
short: true
},
{
title: 'Author',
value: ${{ github.event.client_payload.author }},
short: true
},
{
title: 'Preview URL',
value: ${{ github.event.client_payload.previewURL }},
short: true
}]
}]
}
env:
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Loading