fix(ci): build changelog from last stable release tag

This commit is contained in:
thibaud-lclr 2026-04-14 10:28:15 +02:00
parent fcf8d71349
commit 1c40546f3f

View file

@ -26,13 +26,19 @@ jobs:
set -euo pipefail
current_tag="${GITHUB_REF_NAME}"
previous_tag=""
previous_stable_tag=""
if previous_tag="$(git describe --tags --abbrev=0 "${current_tag}^" 2>/dev/null)"; then
range="${previous_tag}..${current_tag}"
if previous_stable_tag="$(
git describe --tags --abbrev=0 \
--exclude '*-rc*' \
--exclude '*-beta*' \
--exclude '*-alpha*' \
"${current_tag}^" 2>/dev/null
)"; then
range="${previous_stable_tag}..${current_tag}"
{
printf '## Changelog\n\n'
printf 'Changes since `%s`.\n\n' "${previous_tag}"
printf 'Changes since `%s`.\n\n' "${previous_stable_tag}"
git log --reverse --pretty=format:'- %h %s' "${range}"
printf '\n'
} >CHANGELOG.md