Skip to content

Commit

Permalink
Port slack notification over from KDS (#13)
Browse files Browse the repository at this point in the history
* port over from KDS

* add changeset

* update messaging
  • Loading branch information
gyfchong authored Aug 24, 2023
1 parent 86b4ad0 commit b15e120
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .changeset/silent-coats-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
30 changes: 12 additions & 18 deletions .github/workflows/changeset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,37 @@ jobs:
version:
runs-on: ubuntu-latest
outputs:
published: ${{ steps.changesets.outputs.published }}
hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
hasPublished: ${{ steps.changesets.outputs.published }}
env:
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Create Release Pull Request or Publish to npm
id: changesets
run: |
npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
- uses: changesets/action@v1
id: changesets
with:
title: "Changeset: Version packages"
commit: "version packages"
version: yarn ci:version
publish: yarn ci:publish
- name: Push git tags
if: steps.changesets.outputs.published == 'true'
run: git push --follow-tags
notify:
notify-slack:
runs-on: ubuntu-latest
needs: version
needs:
version
# We only trigger this flow if the publish is happening, inferred by not having a changeset.
if: needs.version.outputs.hasChangesets == 'false'
env:
PUBLISHED: ${{ needs.version.outputs.hasPublished }}
steps:
- name: Publish successful
if: needs.version.outputs.published == 'true'
uses: slackapi/[email protected]
with:
channel-id: "C02NUQ27G56"
slack-message: "Legacy Packages have been published"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Publish failed
if: needs.version.outputs.published == 'false'
- name: Send
uses: slackapi/[email protected]
with:
channel-id: "C02NUQ27G56"
slack-message: "Legacy Publish failed"
slack-message: ${{ env.PUBLISHED == 'true' && 'Legacy packages have been published' || 'Legacy Publishing failed' }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 comments on commit b15e120

Please sign in to comment.