Skip to content

Commit

Permalink
Merge pull request #228 from DopplerHQ/slack_changelog
Browse files Browse the repository at this point in the history
chore: include changelog in Slack notification
  • Loading branch information
Piccirello authored Jun 18, 2021
2 parents 688eabf + b4d9fe3 commit fb35dac
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions scripts/release/post-release.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

set -e
set -euo pipefail

# print currently configured user to aid with debugging
cloudsmith whoami
Expand Down Expand Up @@ -39,7 +39,17 @@ PACKAGES=$(find dist/*.apk -type f)
publishToCloudsmith alpine alpine any-version "$PACKAGES"

# send Slack notification
CHANGELOG="$(doppler changelog -n 1 --no-check-version | tail -n +2)"
# escape characters for slack https://api.slack.com/reference/surfaces/formatting#escaping
CHANGELOG=${CHANGELOG//&/&}
CHANGELOG=${CHANGELOG//</&lt;}
CHANGELOG=${CHANGELOG//>/&gt;}
# escape double quotes
CHANGELOG=${CHANGELOG//\"/\\\"}
# replace newlines with newline character
CHANGELOG=${CHANGELOG/$'\n'/'\\n'}

VERSION=$(git describe --abbrev=0)
MESSAGE="Doppler CLI <https://github.com/DopplerHQ/cli/releases/tag/$VERSION|v$VERSION> has been released."
MESSAGE="Doppler CLI <https://github.com/DopplerHQ/cli/releases/tag/$VERSION|v$VERSION> has been released. Changelog:\n$CHANGELOG"
curl --tlsv1.2 --proto "=https" -s -X "POST" "$SLACK_WEBHOOK_URL" -H 'Content-Type: application/x-www-form-urlencoded; charset=utf-8' \
--data-urlencode "payload={\"username\": \"CLI Release Bot\", \"text\": \"$MESSAGE\"}"

0 comments on commit fb35dac

Please sign in to comment.