Skip to content

Commit 7b78121

Browse files
committed
feat(workflows): add zulip notification action to release workflow
1 parent cd67603 commit 7b78121

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

‎.github/workflows/release.yaml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,49 @@ jobs:
113113
steps:
114114

115115
- name: create release
116+
id: create_release
116117
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
117118
with:
118119
name: v${{ github.event.inputs.version }}
119120
generate_release_notes: true
120121
tag_name: ${{ github.event.inputs.version }}
121122

123+
- name: fetch generated changelog
124+
id: changelog
125+
if: steps.create_release.outcome == 'success'
126+
continue-on-error: true
127+
env:
128+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129+
run: |
130+
# generate_release_notes builds the changelog server-side, so pull
131+
# it back down here rather than trying to reconstruct it locally.
132+
gh release view "${{ github.event.inputs.version }}" --repo "${{ github.repository }}" --json body -q .body > changelog.txt
133+
134+
- name: notify Zulip of release
135+
if: steps.create_release.outcome == 'success'
136+
continue-on-error: true
137+
env:
138+
ZULIP_BOT_EMAIL: ${{ secrets.ZULIP_BOT_EMAIL }}
139+
ZULIP_BOT_API_KEY: ${{ secrets.ZULIP_BOT_API_KEY }}
140+
ZULIP_SITE: ${{ secrets.ZULIP_SITE }}
141+
REPO: ${{ github.event.repository.name }}
142+
TAG: v${{ github.event.inputs.version }}
143+
RELEASE_URL: ${{ steps.create_release.outputs.url }}
144+
run: |
145+
CONTENT=$(cat <<EOF
146+
**${REPO}** [${TAG}](${RELEASE_URL}) has been released 🎉
147+
148+
$(cat changelog.txt)
149+
EOF
150+
)
151+
152+
curl -sSf "${ZULIP_SITE}/api/v1/messages" \
153+
-u "${ZULIP_BOT_EMAIL}:${ZULIP_BOT_API_KEY}" \
154+
--data-urlencode type=stream \
155+
--data-urlencode "to=announcements" \
156+
--data-urlencode "topic=software releases" \
157+
--data-urlencode "content=${CONTENT}"
158+
122159
pypi:
123160
name: make pypi release
124161
needs: [tag, release]

0 commit comments

Comments
 (0)