Skip to content

Commit 1f18b13

Browse files
committed
ci: give pre-releases a stable-style changelog body
Replace the generic pre-release body with the pending version's section from release-please's CHANGELOG.md (read off its release-PR branch) — the same grouped Features / Bug Fixes notes the stable release will ship, so each pre-release previews exactly what's coming in v<base>. Falls back to a short note when no release PR is open. Body is assembled in a file via printf to keep markdown intact. Signed-off-by: Mohammod Al Amin Ashik <maa.ashik00@gmail.com>
1 parent 53afa2d commit 1f18b13

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,35 @@ jobs:
147147
GH_TOKEN: ${{ github.token }}
148148
run: |
149149
set -euo pipefail
150-
TAG="v${{ steps.compute.outputs.version }}"
150+
VERSION="${{ steps.compute.outputs.version }}"
151+
TAG="v${VERSION}"
152+
BASE="${VERSION%-*}" # strip the -<run_number> pre-release identifier
153+
BOT_BRANCH="release-please--branches--main--components--mcpmux"
154+
155+
# Build release notes that mirror the stable changelog: pull the
156+
# pending version's section straight from release-please's CHANGELOG
157+
# on its release-PR branch (grouped Features / Bug Fixes / etc.), so
158+
# the pre-release previews exactly what stable v$BASE will ship.
159+
# Assembled into a file with printf to keep markdown intact (no YAML
160+
# block-scalar indentation leaking into the body).
161+
NOTE="Automated pre-release of v${BASE}, built from main (${{ github.sha }}). Early build — may be unstable; switch to the Stable channel in Settings → Software Updates for published releases."
162+
printf '%s\n' "$NOTE" > body.md
163+
if CL=$(gh api "repos/${{ github.repository }}/contents/CHANGELOG.md?ref=${BOT_BRANCH}" --jq '.content' 2>/dev/null); then
164+
# Extract the top (pending) version section: from the first "## "
165+
# header up to, but not including, the next one.
166+
SECTION=$(printf '%s' "$CL" | base64 -d | awk '/^## /{c++} c==2{exit} c>=1{print}')
167+
if [ -n "$SECTION" ]; then
168+
# The section carries release-please's own "## [version] (date)"
169+
# header + grouped Features/Bug Fixes — same as the stable notes.
170+
printf '\n%s\n' "$SECTION" >> body.md
171+
fi
172+
fi
173+
151174
RELEASE_ID=$(gh api --method POST "repos/${{ github.repository }}/releases" \
152175
-f tag_name="$TAG" \
153176
-f target_commitish="${{ github.sha }}" \
154177
-f name="McpMux $TAG" \
155-
-f body="Automated pre-release built from main (${{ github.sha }}). Early build — may be unstable. Use the Stable channel in Settings → Software Updates for published releases." \
178+
-f body="$(cat body.md)" \
156179
-F draft=true -F prerelease=true \
157180
--jq '.id')
158181
echo "release_id=$RELEASE_ID" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)