-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathpublish-new-doc.sh
More file actions
executable file
·40 lines (28 loc) · 996 Bytes
/
publish-new-doc.sh
File metadata and controls
executable file
·40 lines (28 loc) · 996 Bytes
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
#!/bin/bash
# check that local changes are committed
while true; do
read -p "Did you commit your local changes?" yn
case $yn in
[Yy]* ) break;;
[Nn]* ) echo "please commit and execute it again"; exit;;
* ) echo "Please answer yes or no.";;
esac
done
commit_id=`git log --format="%H" -n 1`
branch_id=doc-$(date "+%Y-%m-%d")
# build the documentation
mkdocs build --clean
# create a temporary folder for cloning the website repository
tmp=`mktemp -d`
git clone git@github.com:openbaton/openbaton.github.io.git $tmp/web
# copying the updated documentation on the documentation folder of the website
cp -r site/ $tmp/web/documentation
pushd $tmp/web
# create a new branch for adding the new documentation content
git checkout -b $branch_id
# commit changes with latest commit id
git add -A
git commit -m "Updated documentation folder with content from $commit_id of docs master branch"
# push changes on master branch
git push origin $branch_id
popd