fix: add slack release message #695
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Install pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
version: latest | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Build package | |
run: pnpm build | |
- name: Run specs | |
env: | |
CL_SDK_ORGANIZATION: sdk-test-org | |
CL_SDK_CLIENT_ID: yOIJ1s3ez-hi1VhIlVk30Fe7EK152ixnfGN1zEkiX0I | |
CL_SDK_CLIENT_SECRET: XTP4tDrA2u-56I3NwYk1wIpmSHvl2kTqyetkSJw2KzI | |
run: pnpm test | |
- name: Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: pnpx semantic-release | |
- name: Post to a Slack channel | |
id: slack | |
uses: slackapi/slack-github-action@v1.22.0 | |
with: | |
# Slack channel id, channel name, or user id to post message. | |
# See also: https://api.slack.com/methods/chat.postMessage#channels | |
# channel-id: 'pipeline' | |
# For posting a rich message using Block Kit | |
payload: | | |
{ | |
"text": "New release ${{github.ref_name}} for ${{github.event.repository.name}}.", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "New release for <${{github.event.repository.html_url}}|`${{github.event.repository.name}}`>\n*<${{github.event.release.html_url}}|release notes>*" | |
} | |
}, | |
{ | |
"type": "section", | |
"fields": [ | |
{ | |
"type": "mrkdwn", | |
"text": "*Project:*\n${{github.event.repository.name}}" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*Version:*\n${{github.ref_name}}" | |
} | |
] | |
}, | |
{ | |
"type": "context", | |
"elements": [ | |
{ | |
"type": "image", | |
"image_url": "${{github.event.sender.avatar_url}}", | |
"alt_text": "${{github.event.sender.login}}" | |
}, | |
{ | |
"type": "mrkdwn", | |
"text": "*${{github.event.sender.login}}* has triggered this release." | |
} | |
] | |
} | |
] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.PIPELINE_SLACK_CHANNEL_WEBHOOK_URL }} | |
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |