Skip to content

Commit

Permalink
[changelog] Tweak script
Browse files Browse the repository at this point in the history
  • Loading branch information
mislav committed Jan 21, 2020
1 parent 2b471bd commit 7e164d4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
21 changes: 10 additions & 11 deletions script/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,16 @@
# Show changes to runtime files between HEAD and previous release tag.
set -e

head="${1:-HEAD}"
current_tag="${GITHUB_REF#refs/tags/}"
start_ref="HEAD"

for sha in `git rev-list -n 100 --first-parent "$head"^`; do
previous_tag="$(git tag -l --points-at "$sha" 'v*' 2>/dev/null || true)"
[ -z "$previous_tag" ] || break
# Find the previous release on the same branch, skipping prereleases if the
# current tag is a full release
previous_tag=""
while [[ -z $previous_tag || ( $previous_tag == *-* && $current_tag != *-* ) ]]; do
previous_tag="$(git describe --tags "$start_ref"^ --abbrev=0)"
start_ref="$previous_tag"
done

if [ -z "$previous_tag" ]; then
echo "Couldn't detect previous version tag" >&2
exit 1
fi

git log --no-merges --format='%C(auto,green)* %s%C(auto,reset)%n%w(0,2,2)%+b' \
--reverse "${previous_tag}..${head}" -- `script/build files` etc share
git log --first-parent --format='%C(auto,green)* %s%C(auto,reset)%n%w(0,2,2)%+b' \
--reverse "${previous_tag}.." -- `script/build files` etc share
2 changes: 1 addition & 1 deletion script/tag-release
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ git commit -m "hub $version" -- "$version_file"
notes_file="$(mktemp)"
{ echo "hub $version"
echo
script/changelog
GITHUB_REF="refs/tags/v$version" script/changelog
} >"$notes_file"
trap "rm -f '$notes_file'" EXIT

Expand Down

0 comments on commit 7e164d4

Please sign in to comment.