forked from dlaruelle/mdwiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
upload-build.sh
executable file
·62 lines (47 loc) · 1.9 KB
/
upload-build.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
# fail on first error
set -e
STABLE_VERSION="v0.6"
UNSTABLE_VERSION="v0.7"
# don't do anything on pull requests
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
exit 0
fi
mkdir $HOME/mdwiki/
cp dist/mdwiki.html $HOME/mdwiki/mdwiki-latest.html
cp dist/mdwiki-debug.html $HOME/mdwiki/mdwiki-latest-debug.html
git config --global user.email "[email protected]"
git config --global user.name "Travis"
cd $HOME
echo -e "Updating mdwiki website with latest version"
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/Dynalon/mdwiki.git gh-pages > /dev/null
cd gh-pages
IS_STABLE=`head -n 10 $HOME/mdwiki/mdwiki-latest.html |grep $STABLE_VERSION`
IS_UNSTABLE=`head -n 10 $HOME/mdwiki/mdwiki-latest.html |grep $UNSTABLE_VERSION`
if [ IS_STABLE ]; then
cp $HOME/mdwiki/*.html .
git add -f *.html
fi
if [ IS_UNSTABLE ]; then
cp $HOME/mdwiki/mdwiki-latest.html ./unstable/index.html
cp $HOME/mdwiki/mdwiki-latest-debug.html ./unstable/index-debug.html
git add -f unstable/*.html
fi
# add, commit and push files
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages"
git push -fq origin gh-pages > /dev/null
echo -e "Done updating main mdwiki website\n"
# Update MDwiki Seed project with latest *stable* version of MDwiki (which is the index.html we use
# for the MDwiki website)
if [ IS_STABLE ]; then
echo -e "Updating mdwiki-seed with latest stable version"
cd $HOME
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/Dynalon/mdwiki-seed.git gh-pages-seed > /dev/null
cd gh-pages-seed
# in mdwiki-seed we don't use index.html but mdwiki.html and leave it up to the user to rename
cp $HOME/gh-pages/index.html ./mdwiki.html
git add -f *.html
git commit -m "Travis build $TRAVIS_BUILD_NUMBER pushed to gh-pages"
git push -fq origin gh-pages
echo -e "Successfully updated mdwiki-seed with latest stable version"
fi