1
0
Fork 0
easejs/tools/release-notes

59 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
#
# Release note HTML generation
#
# Copyright (C) 2015 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
##
release-tags() {
local -i limit="$1"
git tag -l '[0-9]*' \
| tac \
| { test $limit -gt 0 \
&& head -n$limit \
|| cat; }
}
tag-subject() {
local tag="${1?Missing tag}"
git tag -n1 -l "$tag" \
| sed 's/ \+/: /'
}
tag-body() {
local tag="${1?Missing tag}"
git cat-file tag "$tag" \
| awk '/^-----BEGIN PGP SIGNATURE-----$/ { exit; }
nl>=2 { print; next; }
/^$/ { nl++; }' \
| sed 's/&/\&amp\;/g
s/</\&lt\;/g;
s/>/\&gt\;/g;'
}
# optional limit
declare -i limit="$1"
for t in $( release-tags "$limit" ); do
cat <<EOF
<h4>$( tag-subject "$t" )</h4>
<pre>$( tag-body "$t" )</pre>
EOF
done