Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,33 @@ jobs:
--pending-version "${{ needs.pending.outputs.version }}" \
--pending-kind "${{ needs.pending.outputs.kind }}")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Install git-cliff
if: steps.guard.outputs.should-release == 'true'
run: |
set -euo pipefail
cargo binstall -y git-cliff || cargo install git-cliff
git cliff --version
# Per-nightly changelog: the delta since the PREVIOUS nightly tag (not
# since the last stable). Computed BEFORE tagging this run, so the newest
# existing v*-nightly.* tag is genuinely the prior nightly. First-ever
# nightly (no prior nightly tag) falls back to since-last-stable.
- name: Compute per-nightly changelog
id: nightly_changelog
if: steps.guard.outputs.should-release == 'true'
run: |
set -euo pipefail
PREV_NIGHTLY=$(git tag -l 'v*-nightly.*' --sort=-creatordate | head -1 || true)
if [ -n "$PREV_NIGHTLY" ]; then
echo "::notice::Changelog range ${PREV_NIGHTLY}..HEAD"
git cliff --config cliff.toml "${PREV_NIGHTLY}..HEAD" --strip header > /tmp/nightly-changelog.md 2>/dev/null || true
else
echo "::notice::No prior nightly tag; changelog falls back to since-last-stable."
git cliff --config cliff.toml --unreleased --strip header > /tmp/nightly-changelog.md 2>/dev/null || true
fi
# Collapse to empty if git-cliff produced only whitespace/heading noise.
if ! grep -qE '^- ' /tmp/nightly-changelog.md; then
: > /tmp/nightly-changelog.md
fi
- name: Tag libxmtp hub
if: steps.guard.outputs.should-release == 'true'
run: xmtp-release tag-release --sdk libxmtp --version "${{ steps.hubver.outputs.version }}" --ignore-if-exists
Expand Down Expand Up @@ -437,6 +464,15 @@ jobs:
See per-SDK release notes under \`docs/release-notes/\`.
EOF
)
# Append the per-nightly changelog (delta since the previous nightly),
# if git-cliff produced any entries.
if [ -s /tmp/nightly-changelog.md ]; then
BODY="${BODY}

## Changes since the last nightly

$(cat /tmp/nightly-changelog.md)"
fi
if gh release view "v${HUB_VERSION}" >/dev/null 2>&1; then
gh release edit "v${HUB_VERSION}" \
--title "libxmtp ${HUB_VERSION}" \
Expand Down
7 changes: 6 additions & 1 deletion cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ body = """
### {{ group | striptags | trim | upper_first }}
{% for commit in commits %}
- {% if commit.scope %}*({{ commit.scope }})* {% endif %}\
{{ commit.message | upper_first }}\
{{ commit.message | split(pat="\n") | first | trim | upper_first }}\
{% endfor %}
{% endfor %}\n
"""
Expand Down Expand Up @@ -56,4 +56,9 @@ commit_parsers = [
{ message = "^chore\\(release\\)", skip = true },
{ message = "^chore|^ci|^build", group = "<!-- 6 -->Miscellaneous" },
{ body = ".*security", group = "<!-- 7 -->Security" },
# Catch-all: non-conventional commits (no recognized type) go into one "Other"
# bucket instead of git-cliff inventing a fake per-scope group from a leading
# `word:`/`word/word:` prefix (which produced sections like "Xmtp_proto",
# "Bindings/mobile"). Sorts last via the high <!-- 8 --> prefix.
{ message = ".*", group = "<!-- 8 -->Other" },
]
Loading