-
Notifications
You must be signed in to change notification settings - Fork 2
/
gh-pages.sh
44 lines (32 loc) · 1.11 KB
/
gh-pages.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
#!/usr/bin/env bash
org="openfin"
# set variable repo to current directory name (without path)
repo=${PWD##*/}
# make sure the docs are built
gulp doc >/dev/null
# remove temp directory in case it already exists, remake it, switch to it
rm -rf ../temp >/dev/null
mkdir ../temp
pushd ../temp >/dev/null
# clone it so it will be a branch of the repo
git clone -q --single-branch http://github.com/$org/$repo.git
cd $repo >/dev/null
# create and switch to a new gh-pages branch
git checkout -q --orphan gh-pages
# remove all content from this new branch
git rm -rf -q .
# copy the doc directory from the workspace
cp -R ../../$repo/doc/* . >/dev/null
# copy $repo/build to the cdn directory
# cp ../../$repo/build/* . >/dev/null
# send it up
git add . >/dev/null
git commit -q -m '(See gh-pages.sh on master branch.)'
git push -ufq origin gh-pages >/dev/null
# back to workspace
popd >/dev/null
# remove temp directory
rm -rf ../temp >/dev/null
echo 'Opening page at http://$org.github.io/$repo/ ...'
open http://$org.github.io/$repo/
echo 'CAVEAT: New pages will not be immediately available so wait a few minutes and refresh.'