Skip to content

Commit

Permalink
Improve Slack notifications on release (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahosgood authored Oct 25, 2023
1 parent 49ebba2 commit 27f287c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ jobs:
outputs:
version: ${{ steps.get-version.outputs.VERSION }}

release-notes:
runs-on: ubuntu-latest
needs:
- check
steps:
- uses: actions/checkout@v3
- name: Get release notes
id: get-release-notes
run: |
RELEASE_NOTES=$(./tasks/get-release-notes.sh "${{ needs.check.outputs.version }}")
echo $RELEASE_NOTES
echo "RELEASE_NOTES=$RELEASE_NOTES" >> "$GITHUB_OUTPUT"
outputs:
release-notes: ${{ steps.get-release-notes.outputs.RELEASE_NOTES }}

lint:
runs-on: ubuntu-latest
needs:
Expand Down Expand Up @@ -106,10 +121,13 @@ jobs:
runs-on: ubuntu-latest
needs:
- check
- release-notes
- publish-npm
steps:
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON: "https://raw.githubusercontent.com/nationalarchives/tna-frontend/main/src/nationalarchives/assets/images/apple-touch-icon.png"
SLACK_TITLE: "v${{ needs.check.outputs.version }} of `tna-frontend` has just been published"
- uses: rtCamp/action-slack-notify@v2
env:
SLACK_TITLE: "`v${{ needs.check.outputs.version }}` of `tna-frontend` has just been published"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_ICON: "https://raw.githubusercontent.com/nationalarchives/tna-frontend/main/src/nationalarchives/assets/images/apple-touch-icon.png"
MSG_MINIMAL: true
SLACK_MESSAGE: ${{ needs.release-notes.outputs.release-notes }}
2 changes: 1 addition & 1 deletion tasks/get-release-notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -e
awk -v ver="$1" '
/^## \[[0-9]+.[0-9]+.[0-9]+/ {
/^## \[[0-9]+\.[0-9]+\.[0-9]+/ {
if (p) { exit };
if (index($2, "[")) {
split($2, a, "[");
Expand Down

0 comments on commit 27f287c

Please sign in to comment.