-
Notifications
You must be signed in to change notification settings - Fork 25
/
release.sh
executable file
·62 lines (50 loc) · 1.47 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
NAME="runcible"
VERSION=`cat ./lib/runcible/version.rb | grep VERSION | awk -F "'" '{print $2}'`
read -p "Would you like to release $NAME-$VERSION (yes/no/skip)? "
if [ "$REPLY" == "yes" ]; then
gem build runcible.gemspec || exit -1
gem push runcible-$VERSION.gem || exit -1
elif [ "$REPLY" == "skip" ]; then
echo "Skipping"
else
echo "Exiting"
exit -1
fi
read -p "Would you like to release documentation for $NAME-$VERSION (yes/no/skip)? "
if [ "$REPLY" == "yes" ]; then
#validate upstream remote
git remote | grep upstream
if [ $? -eq 0 ]; then
REMOTE="upstream"
fi
git remote | grep origin
if [ $? -eq 0 -a -z "$REMOTE" ]; then
REMOTE="origin"
fi
if [ -z "$REMOTE" ]; then
echo "Cannot find git remote named 'upstream' or 'origin'" && exit -1
fi
FILE_COUNT=`git ls-files --exclude-standard --others | wc -l`
if [ "$FILE_COUNT" != "0" ]; then
echo "Untracked files found, cannot build. Please clean your tree before building." && exit -1
fi
#checkout gh-pages branch if needed
git branch | grep gh-pages
if [ $? -ne 0 ]; then
git branch gh-pages $REMOTE/gh-pages || exit -1
fi
echo "Building docs"
yard doc || exit -1
git checkout gh-pages || exit -1
cp -rf doc/* ./
git add ./
git commit -a -m "Updating docs to version $VERSION"
echo "* To push out new docs:"
echo " git push $REMOTE gh-pages:gh-pages"
elif [ "$REPLY" == "skip" ]; then
echo "Skipping"
else
echo "Exiting"
exit -1
fi