forked from gavofyork/graypaper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.sh
executable file
·31 lines (24 loc) · 1.18 KB
/
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
#!/bin/bash
[ `git diff --name-only | wc -l` -gt 0 ] && echo "There are uncommitted changes. Please commit or stash them before releasing." && exit 1
VERSION=`cat VERSION`
OBRANCH=`git branch --show-current`
RBRANCH="release-v$VERSION"
echo "Releasing version $VERSION from branch $OBRANCH into branch $RBRANCH..."
git checkout -b $RBRANCH
echo -n '' > context.tex
echo "Committing..."
git commit -a -m "Release version $VERSION"
echo "Building PDF..."
cp graypaper.tex graypaper-$VERSION.tex
function cleanup() {
rm graypaper-$VERSION.aux graypaper-$VERSION.bbl graypaper-$VERSION.blg graypaper-$VERSION.log graypaper-$VERSION.out graypaper-$VERSION.tex* graypaper-$VERSION.run.xml graypaper-$VERSION.bcf
git checkout $OBRANCH
}
xelatex -halt-on-error graypaper-$VERSION > /dev/null || ( echo "Cannot build tex. Please fix before releasing." && cleanup && exit 1 )
biber graypaper-$VERSION > /dev/null || ( echo "Cannot build bib. Please fix before releasing." && cleanup && exit 1 )
xelatex -halt-on-error graypaper-$VERSION > /dev/null
xelatex -halt-on-error graypaper-$VERSION > /dev/null
echo "Tagging && pushing..."
git tag -a v$VERSION -m "Version $VERSION"
git push --tags
cleanup