pub-release: changelog since the previous release in the release body

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-12 16:24:57 +01:00
1 parent 507842cea2
commit e3200086c4
1 file changed
+62 -3
+62 -3
View File
@@ -12,7 +12,9 @@
# Runs on every push to main -- the export pushes there only after an
# upstream merge (private repo, tth-upstream-sync) -- and by hand.
# Release tag tth-<sha8>, titled with the stamped version (v1.18.0-tth<sha>);
# the newest KEEP releases stay, older ones are deleted.
# the newest KEEP releases stay, older ones are deleted. The body is a
# changelog since the previous release: our own commits, then the upstream
# PRs the upstream merges brought in.
# nRF52: .uf2 (drag onto the bootloader drive) and .zip (DFU over BLE or
# serial); ESP32: -merged.bin (fresh install at 0x0) and .bin (update).
name: pub-release
@@ -160,8 +162,65 @@ jobs:
rxlog / pktlog rings for the repeater observer.
Czech mesh defaults (meshcore.cz): 869.432 MHz / 62.5 kHz / SF7 / CR5; repeater: zero-hop advert off,
flood advert 25 h, af 9 (10 % duty cycle), regions cz + cs. Apply to a fresh or erased node only.'
body=$(printf '%s\n\ncommit %s, run %s\n\n%s\nWhat this fork changes against upstream: see README.md.\n' \
"$VERSION" "$SHA" "$GITHUB_RUN_NUMBER" "$note")
web="$GITEA/$GITHUB_REPOSITORY"
gh=https://github.com/meshcore-dev/MeshCore
max=60
# changelog against the newest older release that HEAD descends from
prev="" base=""
while read -r t c; do
if [ "$c" != "$SHA" ] && git merge-base --is-ancestor "$c" "$SHA" 2>/dev/null; then
prev=$t base=$c
break
fi
done < <(curl -sSf --config - "$api/releases?limit=50" <<<"$auth" |
jq -r --arg t "$TAG" 'map(select(.tag_name | startswith("tth-")) | select(.tag_name != $t))
| sort_by(.created_at) | reverse | .[] | "\(.tag_name) \(.target_commitish)"')
# no older release: the last 20 commits of our own line
[ -n "$base" ] || base=$(git rev-list --first-parent --max-count=21 "$SHA" | tail -1)
# ours: commits on our main itself (first parent), not what the
# upstream merges brought in
ours=$(git log --first-parent --no-merges --format="- %s ([%h]($web/commit/%H))" "$base..$SHA")
# upstream: the first-parent line of each merged upstream branch,
# PR merges as their title, direct commits as their subject
declare -A seen=()
ups=()
for m in $(git log --first-parent --merges --grep='^Merge upstream' --format=%H "$base..$SHA"); do
for c in $(git log --first-parent --format=%H "$m^1..$m^2"); do
s=$(git log -1 --format=%s "$c")
if [[ $s =~ ^Merge\ pull\ request\ \#([0-9]+)\ from\ ([^/]+)/(.*)$ ]]; then
pr=${BASH_REMATCH[1]}
[ -z "${seen[$pr]:-}" ] || continue
seen[$pr]=1
t=$(git log -1 --format=%b "$c" | sed -n '/./{p;q}')
ups+=("- ${t:-${BASH_REMATCH[3]}} ([#$pr]($gh/pull/$pr), ${BASH_REMATCH[2]})")
elif [[ $s != Merge* ]]; then
[ -z "${seen[$c]:-}" ] || continue
seen[$c]=1
ups+=("- $s ([${c:0:7}]($gh/commit/$c))")
fi
done
done
n=${#ups[@]}
body=$(
echo "$VERSION"
echo
if [ -n "$prev" ]; then
echo "Od předchozího vydání · since [$prev]($web/releases/tag/$prev)"
echo
fi
echo "### Změny forku · fork changes"
echo "${ours:-- žádné · none}"
echo
echo "### Z upstreamu MeshCore · from upstream ($n)"
[ "$n" -gt 0 ] && printf '%s\n' "${ups[@]:0:$max}" || echo "- žádné · none"
[ "$n" -le "$max" ] || echo "- … a dalších $((n - max)) · and $((n - max)) more"
echo
echo "### Po flashi · after flashing"
echo "$note"
echo "What this fork changes against upstream: see README.md."
echo
echo "commit $SHA, run $GITHUB_RUN_NUMBER"
)
jq -n --arg t "$TAG" --arg c "$SHA" --arg n "$VERSION" --arg b "$body" \
'{tag_name: $t, target_commitish: $c, name: $n, body: $b}' >"$RUNNER_TEMP/rel.json"
id=$(curl -sSf --config - -X POST -H 'Content-Type: application/json' \