forked from tohojo/flent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mkrelease.sh
executable file
·51 lines (35 loc) · 1.76 KB
/
mkrelease.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
47
48
49
50
51
#!/bin/bash
VERSION="$1"
die()
{
echo "$@" >&2
exit 1
}
[ -n "$VERSION" ] || die "Usage: $0 <version>."
echo ==== Updating source code version numbers to ${VERSION}... ====
sed -i s/VERSION=\"[0-9\\.]\\+\\\(-git\\\)\\?\"/VERSION=\"${VERSION}\"/ flent/build_info.py || die error
sed -i -e "s/version = '[0-9\\.]\\+\\(-git\\)\\?'/version = '${VERSION}'/" doc/conf.py || die error
make man || die error
if [[ ! "$VERSION" =~ -git$ ]]; then
echo ==== Updating Debian changelog and Arch PKGBUILD version... ====
sed -i -e "s/pkgver=.*/pkgver=${VERSION}/" -e "s/sha1sums=([^)]\\+)/sha1sums=()/" packaging/archlinux/PKGBUILD || die error
tmpfile=$(mktemp)
cat >$tmpfile <<EOF
flent (${VERSION}-1) precise; urgency=low
* Bump to release ${VERSION}.
-- Toke Høiland-Jørgensen <[email protected]> $(date +"%a, %d %b %Y %H:%M:%S %z")
EOF
cat packaging/debian/changelog >> $tmpfile || die error
mv $tmpfile packaging/debian/changelog || die error
echo ==== Creating and signing release tarball... ====
python setup.py sdist bdist_wheel || die error
gpg --detach-sign --armor dist/flent-${VERSION}.tar.gz || die error
gpg --detach-sign --armor dist/flent-${VERSION}-py2.py3-none-any.whl || die error
echo ==== Updating Arch PKGBUILD sha1sum... ====
SHA1=$(sha1sum dist/flent-${VERSION}.tar.gz | awk '{print $1}')
sed -i -e "s/sha1sums=('[a-z0-9]\+'/sha1sums=('${SHA1}'/" packaging/archlinux/PKGBUILD || die error
fi
echo ==== Staging changed files ====
git add flent/build_info.py man/flent.1 doc/conf.py packaging/debian/changelog packaging/archlinux/PKGBUILD || die error
echo ==== Done. Review changes and commit \(and tag\). ====
[[ ! "$VERSION" =~ -git$ ]] && echo ==== Upload with \`twine upload dist/flent-${VERSION}*\`. ====