Skip to content

Commit

Permalink
PDCL-7927: add yaml file for notifying slack of release
Browse files Browse the repository at this point in the history
  • Loading branch information
Brent Hosie committed Mar 29, 2022
1 parent 69dc280 commit 293b2c3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/notify.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: CI notify

# Only trigger, when the build workflow succeeded
on:
workflow_run:
workflows: ['Node.js Package']
types:
- completed

jobs:
notify-on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v2
- name: Get latest tag
uses: oprypin/find-latest-tag@v1
with:
repository: "${{ github.repository }}" # The repository to scan.
releases-only: true # We know that all relevant tags have a GitHub release for them.
id: repoTag # The step ID to refer to later.
- name: Show ENV
run: env
- name: Notify Slack of Release
uses: tokorom/action-slack-incoming-webhook@main
env:
INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
text: "A new version of ${{ github.event.repository.full_name }}[${{ steps.repoTag.outputs.tag }}] has been released"
attachments: |
[
{
"color": "good",
"author_name": "${{ github.actor }}",
"author_icon": "${{ github.event.sender.avatar_url }}",
"fields": [
{
"title": "Repo URL",
"value": "${{ github.event.repository.html_url }}"
},
{
"title": "See Releases",
"value": "${{ github.event.repository.html_url }}/releases"
}
]
}
]
4 changes: 2 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: Node.js Package

on:
release:
types: [published]
types: [created]

jobs:
publish-npm:
Expand All @@ -14,7 +14,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 14
registry-url: https://registry.npmjs.org/
- run: npm publish
env:
Expand Down

0 comments on commit 293b2c3

Please sign in to comment.