Skip to content

Commit 78153f6

Browse files
authored
Merge pull request #409 from CCPBioSim/zulip-notify
2 parents 45a897e + d2611c3 commit 78153f6

1 file changed

Lines changed: 38 additions & 2 deletions

File tree

‎.github/workflows/release.yaml‎

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,50 @@ jobs:
111111
needs: tag
112112
runs-on: ubuntu-24.04
113113
steps:
114-
115114
- name: create release
116-
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
115+
id: create_release
116+
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
117117
with:
118118
name: v${{ github.event.inputs.version }}
119119
generate_release_notes: true
120120
tag_name: ${{ github.event.inputs.version }}
121121

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

0 commit comments

Comments
 (0)