Skip to content

Commit 8cf05a4

Browse files
committed
chore: ci downstream notification [skip ci]
1 parent d5e5c22 commit 8cf05a4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Downstream Notifier
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
notify:
10+
name: Notify Downstream
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Dispatch downstream repository
14+
env:
15+
DISPATCH_REPO: f5gov/nginx-webssh2
16+
DOWNSTREAM_TOKEN: ${{ secrets.DOWNSTREAM_TOKEN }}
17+
RELEASE_TAG: ${{ github.event.release.tag_name }}
18+
run: |
19+
set -euo pipefail
20+
if [ -z "${DOWNSTREAM_TOKEN:-}" ]; then
21+
echo 'DOWNSTREAM_TOKEN secret is not configured' >&2
22+
exit 1
23+
fi
24+
25+
payload=$(jq -n --arg version "${RELEASE_TAG}" '{event_type:"webssh2-release", client_payload:{version:$version}}')
26+
27+
response=$(curl --fail-with-body \
28+
-X POST \
29+
-H "Accept: application/vnd.github+json" \
30+
-H "Authorization: Bearer ${DOWNSTREAM_TOKEN}" \
31+
-H "X-GitHub-Api-Version: 2022-11-28" \
32+
https://api.github.com/repos/${DISPATCH_REPO}/dispatches \
33+
-d "${payload}" 2>&1)
34+
35+
if [ -n "${response}" ]; then
36+
echo "Dispatch response: ${response}"
37+
fi
38+
39+
echo "Dispatched webssh2-release to ${DISPATCH_REPO} for tag ${RELEASE_TAG}"

0 commit comments

Comments
 (0)