forked from alecthomas/voluptuous
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_documentation.sh
61 lines (46 loc) · 1.72 KB
/
update_documentation.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
#!/usr/bin/env bash
# Merge pushes to development branch to stable branch
if [ ! -n $2 ] ; then
echo "Usage: merge.sh <username> <password>"
exit 1;
fi
GIT_USER="$1"
GIT_PASS="$2"
# Specify the development branch and stable branch names
FROM_BRANCH="master"
TO_BRANCH="gh-pages"
# Needed for setting identity
git config --global user.email "tusharmakkar08@gmail.com"
git config --global user.name "Tushar Makkar"
git config --global push.default "simple"
# Get the current branch
export PAGER=cat
CURRENT_BRANCH=$(git log -n 1 --pretty=%d HEAD | cut -d"," -f3 | cut -d" " -f2 | cut -d")" -f1)
echo "current branch is '$CURRENT_BRANCH'"
# Create the URL to push merge to
URL=$(git remote -v | head -n1 | cut -f2 | cut -d" " -f1)
echo "Repo url is $URL"
PUSH_URL="https://$GIT_USER:$GIT_PASS@${URL:8}"
git remote set-url origin ${PUSH_URL}
echo "Checking out $FROM_BRANCH..." && \
git fetch origin ${FROM_BRANCH}:${FROM_BRANCH} && \
git checkout ${FROM_BRANCH}
echo "Checking out $TO_BRANCH..." && \
# Checkout the latest stable
git fetch origin ${TO_BRANCH}:${TO_BRANCH} && \
git checkout ${TO_BRANCH} && \
# Merge the dev into latest stable
echo "Merging changes..." && \
git merge ${FROM_BRANCH} && \
# Push changes back to remote vcs
echo "Pushing changes..." && \
git push origin gh-pages &> /dev/null && \
echo "Merge complete!" || \
echo "Error Occurred. Merge failed"
export PYTHONPATH=${PYTHONPATH}:$(pwd):$(pwd)/voluptuous
pip install -r requirements.txt && sphinx-apidoc -o docs -f voluptuous &&
cd docs && make html ||
echo "Sphinx not able to generate HTML"
git status && git add . &&
git commit -m "Auto updating documentation from $CURRENT_BRANCH" &&
git push origin gh-pages &> /dev/null && echo "Documentation pushed"