forked from pniedzielski/doxymacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare-release.sh
executable file
·33 lines (28 loc) · 956 Bytes
/
prepare-release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
# File names
AUTHORS="AUTHORS.md"
NEWS="NEWS.md"
# Make sure we have git installed
GIT_EXECUTABLE=`which git`
if [ "$?" -ne "0" ]; then
echo "Sorry, cannot find git in PATH." >&2
exit 1
fi
# Make sure we are in a git repository
$GIT_EXECUTABLE status > /dev/null 2>&1
if [ "$?" -ne "0" ]; then
echo "Sorry, not in a git repository." >&2
exit 2
fi
# Generate AUTHORS file
authors_text=`$GIT_EXECUTABLE log --format="%aN <%aE>" | sort | uniq | sed "s/^/ * /g"`
echo "Authors\n=======\n\n$authors_text" >$AUTHORS
# Generate NEWS file
tags=`$GIT_EXECUTABLE tag -l --sort="-v:refname" | grep "^v[0-9]"`
news_text="Release Notes\n============="
for tag in $tags; do
date=`$GIT_EXECUTABLE show --quiet --format="%ci" $tag^{commit} | cut -d' ' -f1`
annotation=`$GIT_EXECUTABLE show --quiet --format="" $tag | tail -n +4`
news_text="$news_text\n\n## $date: $annotation\n"
done
echo "$news_text" | head -n -1 >$NEWS