Skip to content

Commit b024c56

Browse files
authored
Merge pull request #28 from NodeDB-Lab/fix/vector-index-ddl-quantization
ci(release): add Discord notification job for new releases
2 parents e5901c5 + 4ee6bf9 commit b024c56

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/release.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,58 @@ jobs:
328328
--tag farhansyah/nodedb:latest \
329329
farhansyah/nodedb:${VERSION}-amd64 \
330330
farhansyah/nodedb:${VERSION}-arm64
331+
332+
# ── Notify Discord ────────────────────────────────────────────────────────────
333+
notify-discord:
334+
name: Notify Discord
335+
needs: [validate-version, publish-crates, github-release]
336+
runs-on: ubuntu-latest
337+
steps:
338+
- uses: actions/checkout@v6
339+
with:
340+
fetch-depth: 0
341+
342+
- name: Build changelog and post to Discord
343+
env:
344+
DISCORD_RELEASE_WEBHOOK_URL: ${{ secrets.DISCORD_RELEASE_WEBHOOK_URL }}
345+
VERSION: ${{ needs.validate-version.outputs.version }}
346+
IS_FULL: ${{ needs.validate-version.outputs.is_full_release }}
347+
REPO: ${{ github.repository }}
348+
run: |
349+
set -euo pipefail
350+
TAG="v${VERSION}"
351+
PREV_TAG=$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || true)
352+
353+
if [[ -n "$PREV_TAG" ]]; then
354+
RANGE="${PREV_TAG}..${TAG}"
355+
COMPARE_URL="https://github.com/${REPO}/compare/${PREV_TAG}...${TAG}"
356+
else
357+
RANGE="${TAG}"
358+
COMPARE_URL="https://github.com/${REPO}/releases/tag/${TAG}"
359+
fi
360+
361+
COMMITS=$(git log "$RANGE" --pretty=format:'- %s (%h)' --no-merges | head -n 25)
362+
[[ -z "$COMMITS" ]] && COMMITS="- (no commits found)"
363+
364+
COUNT=$(git rev-list --count --no-merges "$RANGE" 2>/dev/null || echo 0)
365+
366+
if [[ "$IS_FULL" == "true" ]]; then
367+
COLOR=3066993 # green
368+
TITLE="🚀 New Release: NodeDB ${VERSION}"
369+
else
370+
COLOR=15844367 # amber
371+
TITLE="🚧 New Pre-Release: NodeDB ${VERSION}"
372+
fi
373+
374+
DESC=$(printf '**Changes since %s** (%s commits)\n%s\n\n[Full changelog](%s) · [Release notes](https://github.com/%s/releases/tag/%s)' \
375+
"${PREV_TAG:-start}" "$COUNT" "$COMMITS" "$COMPARE_URL" "$REPO" "$TAG")
376+
377+
PAYLOAD=$(jq -n \
378+
--arg title "$TITLE" \
379+
--arg desc "$DESC" \
380+
--arg url "https://github.com/${REPO}/releases/tag/${TAG}" \
381+
--argjson color "$COLOR" \
382+
'{embeds:[{title:$title,url:$url,description:$desc,color:$color}]}')
383+
384+
curl -fsS -H "Content-Type: application/json" \
385+
-X POST -d "$PAYLOAD" "$DISCORD_RELEASE_WEBHOOK_URL"

0 commit comments

Comments
 (0)