Skip to content

Commit 8c2fd5d

Browse files
committed
Add basic release script
1 parent 8362fa7 commit 8c2fd5d

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

dev-bin/release.sh

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#!/bin/bash
2+
3+
set -eu -o pipefail
4+
5+
changelog=$(cat HISTORY.rst)
6+
7+
regex='
8+
([0-9]+\.[0-9]+\.[0-9]+) \(([0-9]{4}-[0-9]{2}-[0-9]{2})\)
9+
\+*
10+
11+
((.|
12+
)*)
13+
'
14+
15+
if [[ ! $changelog =~ $regex ]]; then
16+
echo "Could not find date line in change log!"
17+
exit 1
18+
fi
19+
20+
version="${BASH_REMATCH[1]}"
21+
date="${BASH_REMATCH[2]}"
22+
notes="$(echo "${BASH_REMATCH[3]}" | sed -n -e '/^[0-9]\+\.[0-9]\+\.[0-9]\+/,$!p')"
23+
24+
if [[ "$date" -ne $(date +"%Y-%m-%d") ]]; then
25+
echo "$date is not today!"
26+
exit 1
27+
fi
28+
29+
tag="v$version"
30+
31+
if [ -n "$(git status --porcelain)" ]; then
32+
echo ". is not clean." >&2
33+
exit 1
34+
fi
35+
36+
perl -pi -e "s/(?<=__version__ = ').+?(?=')/$version/g" minfraud/version.py
37+
38+
echo $"Test results:"
39+
python setup.py test
40+
41+
echo $'\nDiff:'
42+
git diff
43+
44+
echo $'\nRelease notes:'
45+
echo "$notes"
46+
47+
read -e -p "Commit changes and push to origin? " should_push
48+
49+
if [ "$should_push" != "y" ]; then
50+
echo "Aborting"
51+
exit 1
52+
fi
53+
54+
git commit -m "Update for $tag" -a
55+
56+
git push
57+
58+
message="$version
59+
60+
$notes"
61+
62+
hub release create -a "$phar" -m "$message" "$tag"
63+
64+
git push --tags
65+
66+
python setup.py release

0 commit comments

Comments
 (0)