-
Notifications
You must be signed in to change notification settings - Fork 0
/
gh-pages.sh
executable file
·39 lines (29 loc) · 1 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
#!/usr/bin/env bash
org="joneit"
module="extend-me"
# set variable repo to current directory name (without path)
repo=${PWD##*/}
# 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 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/$repo.html
echo 'CAVEAT: New pages will not be immediately available so wait a few minutes and refresh.'