From 27f287c6ba2c6c3b48ccce138f418675cb9218e1 Mon Sep 17 00:00:00 2001 From: Andrew Hosgood Date: Wed, 25 Oct 2023 15:38:12 +0100 Subject: [PATCH] Improve Slack notifications on release (#35) --- .github/workflows/npm-publish.yml | 28 +++++++++++++++++++++++----- tasks/get-release-notes.sh | 2 +- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index ea7b0061..c5814410 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -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: @@ -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" \ No newline at end of file + - 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 }} diff --git a/tasks/get-release-notes.sh b/tasks/get-release-notes.sh index 80cbb0ed..34a94980 100755 --- a/tasks/get-release-notes.sh +++ b/tasks/get-release-notes.sh @@ -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, "[");