From 3cf72cc3af295702f06cd982b2423bfb659da8b6 Mon Sep 17 00:00:00 2001 From: Nicolas CHAIX Date: Fri, 24 Jul 2026 19:08:27 +0200 Subject: [PATCH] notify release slack channel after publication --- .github/workflows/publish.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8cb889e..d4ceabb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -28,3 +28,29 @@ jobs: flutter_package: true skip_test: true dry_run: false + + notify: + name: Notify Slack + needs: publish + # Release context is only available when triggered by a release (not workflow_dispatch) + if: github.event_name == 'release' + runs-on: ubuntu-latest + + steps: + - name: Send release announcement to Slack + env: + SLACK_WEBHOOK: ${{ secrets.RELEASES_SLACK_WEBHOOK }} + RELEASE_TAG: ${{ github.event.release.tag_name }} + RELEASE_BODY: ${{ github.event.release.body }} + RELEASE_URL: ${{ github.event.release.html_url }} + run: | + # Extract the changelog from the release body: + # drop the "More info" trailer and the leading "- " list markers. + # Trailing blank lines are stripped by the command substitution. + changelog=$(printf '%s\n' "$RELEASE_BODY" | tr -d '\r' | sed -e '/^More info:/,$d' -e 's/^- //') + + text=$(printf '*Flutter SDK version `%s`* is now available :rocket:\n```%s```\nhttps://pub.dev/packages/didomi_sdk/versions/%s\n%s' \ + "$RELEASE_TAG" "$changelog" "$RELEASE_TAG" "$RELEASE_URL") + + jq -n --arg text "$text" '{ text: $text }' \ + | curl --silent --show-error --fail -X POST -H 'Content-Type: application/json' -d @- "$SLACK_WEBHOOK"