forked from PyGithub/PyGithub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.sh
executable file
·46 lines (36 loc) · 1.17 KB
/
manage.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
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# -*- coding: utf-8 -*-
set -e
function publish {
bump
readme
push
}
function fix_headers {
python scripts/fix_headers.py
}
function bump {
previousVersion=$( grep '^version =' setup.py | sed 's/version = \"\(.*\)\"/\1/' )
echo "Next version number? (previous: '$previousVersion')"
read version
if [ -z "$version" ]; then
echo "empty version string"
exit 1
fi
sed -i -b "s/version = .*/version = \"$version\"/" setup.py
}
function readme {
# creates a changelog based on the commits from the previous version until now
changelog=$(tail -n +6 doc/changes.rst)
gitlog=$(git log v$previousVersion.. --oneline --pretty=format:'* %s (%h)' | grep -v "Merge")
today=$(date "+(%B %d, %Y)")
echo -e "Change log\n==========\n\nStable versions\n~~~~~~~~~~~~~~~\n\nVersion $version $today\n-----------------------------------\n\n$gitlog\n$changelog" > doc/changes.rst
}
function push {
echo "Break (Ctrl+c) here if something is wrong. Else, press enter"
read foobar
git commit -am "Publish version $version"
git tag -m "Version $version" v$version
git push --tags ${REMOTE:-origin} master
}
$1