-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
release
executable file
·47 lines (34 loc) · 1.16 KB
/
release
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
set -e
NEW="$1"
[ "$NEW" != "" ] || exit 1
echo "Creating release $NEW"
if git describe "$NEW" &>/dev/null; then
echo "Release already exists"
exit 1
fi
NEWBASE=`echo "$NEW"|cut -f1 -d'-'`
PREV=`git tag --sort=creatordate|grep "^$NEWBASE"|tail -1`
############## update Release_notes.txt
NOTES="dist/Release_notes.txt"
echo "-------------------------------------------------" > "$NOTES.new"
echo "Changes in release $NEW (since $PREV)" >> "$NOTES.new"
echo "-------------------------------------------------" >> "$NOTES.new"
echo -e "\nRelease date: `date`\n" >> "$NOTES.new"
git shortlog --no-merges $PREV..HEAD >> "$NOTES.new"
echo >> "$NOTES.new"
cat "$NOTES" >> "$NOTES.new"
mv "$NOTES.new" "$NOTES"
git add "$NOTES"
git commit -m "automatically updated release notes for $NEW"
################ tag and add tag message
echo > /tmp/tagmessage
echo "Release $NEW" >> /tmp/tagmessage
echo >> /tmp/tagmessage
echo "Changes in $NEW (since $PREV):" >> /tmp/tagmessage
echo >> /tmp/tagmessage
git shortlog --no-merges $PREV..HEAD >> /tmp/tagmessage
git tag -a "$NEW" -m "`cat /tmp/tagmessage`"
################ push everything
git push origin HEAD
git push --tags