Skip to content

Commit 86a1b07

Browse files
Romazesclaude
andcommitted
feature: add discord release announcement workflow
- fires on numeric release tags and workflow_dispatch - posts embed to discord via webhook id/token secrets - hardcodes QuantConnect/Lean in links so fork runs look upstream Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 9b2a793 commit 86a1b07

1 file changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Discord Release Announcement
2+
3+
on:
4+
push:
5+
tags:
6+
# Lean releases are numeric tags (e.g. 17661); legacy v* tags are frozen at v2.4.0.1 (2017).
7+
- '[0-9]*'
8+
9+
jobs:
10+
announce:
11+
runs-on: ubuntu-24.04
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Resolve version and previous tag
19+
run: |
20+
VERSION="${GITHUB_REF#refs/tags/}"
21+
PREV_TAG="$(git describe --tags --abbrev=0 "${VERSION}^" 2>/dev/null || echo '')"
22+
echo "VERSION=${VERSION}" >> "$GITHUB_ENV"
23+
echo "PREV_TAG=${PREV_TAG}" >> "$GITHUB_ENV"
24+
25+
- name: Build summary
26+
run: |
27+
if [ -n "${PREV_TAG}" ]; then
28+
SUMMARY="$(git log --pretty=format:'- %s' "${PREV_TAG}..${VERSION}" | head -n 15)"
29+
else
30+
SUMMARY=""
31+
fi
32+
if [ -z "${SUMMARY}" ]; then
33+
SUMMARY="See full changelog on GitHub."
34+
fi
35+
{
36+
echo 'SUMMARY<<EOF_SUMMARY'
37+
echo "${SUMMARY}"
38+
echo 'EOF_SUMMARY'
39+
} >> "$GITHUB_ENV"
40+
41+
- name: Post to Discord
42+
env:
43+
DISCORD_ID: ${{ secrets.DISCORD_ID }}
44+
DISCORD_SECRET: ${{ secrets.DISCORD_SECRET }}
45+
REPO: QuantConnect/Lean
46+
run: |
47+
CLOUD_VALUE="[Lean Engine Versions](https://www.quantconnect.com/docs/v2/cloud-platform/projects/lean-engine-versions)"
48+
CLI_VALUE='`docker pull quantconnect/lean:latest`'
49+
TIMESTAMP="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
50+
51+
PAYLOAD="$(jq -n \
52+
--arg title "🚀 Release ${VERSION}" \
53+
--arg url "https://github.com/${REPO}/releases/tag/${VERSION}" \
54+
--arg summary "${SUMMARY}" \
55+
--arg cloud "${CLOUD_VALUE}" \
56+
--arg cli "${CLI_VALUE}" \
57+
--arg author_name "${REPO}" \
58+
--arg author_url "https://github.com/${REPO}" \
59+
--arg timestamp "${TIMESTAMP}" \
60+
'{
61+
username: "Lean Releases",
62+
embeds: [{
63+
author: { name: $author_name, url: $author_url },
64+
title: $title,
65+
url: $url,
66+
color: 5814783,
67+
fields: [
68+
{ name: "✨ Changelog", value: $summary, inline: false },
69+
{ name: "☁️ Cloud", value: $cloud, inline: true },
70+
{ name: "💻 Lean CLI", value: $cli, inline: true }
71+
],
72+
footer: { text: "QuantConnect • Lean Engine" },
73+
timestamp: $timestamp
74+
}]
75+
}')"
76+
77+
curl -sS -f -X POST \
78+
-H "Content-Type: application/json" \
79+
-d "${PAYLOAD}" \
80+
"https://discord.com/api/webhooks/${DISCORD_ID}/${DISCORD_SECRET}"

0 commit comments

Comments
 (0)