-
Notifications
You must be signed in to change notification settings - Fork 1
/
make-release.sh
executable file
·53 lines (40 loc) · 1.39 KB
/
make-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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
set -e
set -o pipefail
ver=$1
if [ "$ver" == "" ]; then
echo "Usage: $0 version" >&2
exit 1
fi
if [ "$(git symbolic-ref --short HEAD)" != "master" ]; then
echo "Currently checkout out branch must be 'master'" >&2
exit 1
fi
if [ $(git status --porcelain | wc -l) != 0 ]; then
echo "Working copy contains uncommitted changes" >&2
exit 1
fi
if [ $(git ls-remote --tags origin v$ver | wc -l) != 0 ]; then
echo "Version $ver already released (remote tag v$ver already exists)" >&2
exit 1
fi
echo "Updating trumicount (setting version to $ver)" >&2
sed -i.bak 's/^VERSION <- .*$/VERSION <- "'"$ver"'"/' trumicount
rm trumicount.bak
echo "Updating manual/manual.tex (setting version to $ver)" >&2
sed -i.bak 's/^\\version{.*}$/\\version{'"$ver"'}/' manual/manual.tex
rm manual/manual.tex.bak
echo "Updating manual/reference.tex" >&2
(cd manual; ./make-reference-tex)
echo "Updating docs/manual.pdf" >&2
(cd manual; for i in 1 2 3; do pdflatex -interaction batchmode -shell-escape manual.tex >/dev/null 2>&1; done)
cp manual/manual.pdf docs/manual.pdf
echo "Comitting change" >&2
git add trumicount manual/manual.tex manual/reference.tex docs/manual.pdf
git commit -m "Incremented version to $ver"
echo "Tagging as v$ver and latest" >&2
git tag -f v$ver
echo "Pushing to origin" >&2
git push origin master v$ver
echo "Updating 'latest' on origin" >&2
git push -f origin v$ver:refs/tags/latest-release