forked from Juchar/color-picker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgh-pages.sh
executable file
·53 lines (40 loc) · 1.41 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
45
46
47
48
49
50
51
52
53
# This script pushes a demo-friendly version of your element and its
# dependencies to gh-pages.
# usage gp Polymer core-item [branch]
# Run in a clean directory passing in a GitHub org and repo name
GH_REF="github.com/${TRAVIS_REPO_SLUG}"
org=`echo ${TRAVIS_REPO_SLUG} | cut -f 1 -d /`
repo=`echo ${TRAVIS_REPO_SLUG} | cut -f 2 -d /`
name="Travis CI"
email="[email protected]"
branch=${3:-"master"} # default to master when branch isn't specified
mkdir temp && cd temp
# make folder (same as input, no checking!)
mkdir $repo
git clone "https://${GITHUB_TOKEN}@${GH_REF}" --single-branch
# switch to gh-pages branch
pushd $repo >/dev/null
git checkout --orphan gh-pages
# remove all content
git rm -rf -q .
# use bower to install runtime deployment
bower cache clean $repo # ensure we're getting the latest from the desired branch.
git show ${branch}:bower.json > bower.json
echo "{
\"directory\": \"components\"
}
" > .bowerrc
bower install
bower install $org/$repo#$branch
git checkout ${branch} -- demo
rm -rf components/$repo/demo
mv demo components/$repo/
# redirect by default to the component folder
echo "<META http-equiv="refresh" content=\"0;URL=components/$repo/demo\">" >index.html
git config user.name $name
git config user.email $email
# send it all to github
git add -A .
git commit -am 'Deploy to GitHub Pages'
git push --force --quiet -u "https://${GITHUB_TOKEN}@${GH_REF}" gh-pages > /dev/null 2>&1
popd >/dev/null