forked from herd/herdtools7
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
41 lines (32 loc) · 1002 Bytes
/
publish.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
#!/bin/bash
# Assume run as ./publish.sh
. ./defs.sh
set -o errexit
if ! git branch | grep -e "^\* master$" -e "^\* release" >/dev/null
then
echo "Cowardly refusing to publish from branch other than master."
exit 1
fi
# In the following regex, the only significant thing is the space in second position: it detects files changed but not added to git index.
if git status --short | grep -v "^. .*$"
then
echo "Please 'git add' all the changes you want in the publication commit before running './publish.sh'. Or 'git stash' them away."
exit 1
fi
if git tag | grep "^$VERSION$"
then
echo "Set (and 'git add') new version in file 'opam' before running './publish.sh'."
exit 1
fi
if echo "$VERSION" | grep "+"
then
echo "Cowardly refusing to publish a version containing a '+'."
exit 1
fi
make all
git commit --allow-empty --message "Publish version $VERSION"
git tag $VERSION
git push origin master --tags
exit 0
opam publish herdtools7.opam
trap "rm -r herdtools7.$VERSION" EXIT