Skip to content
This repository has been archived by the owner on Sep 5, 2018. It is now read-only.

Commit

Permalink
auto deploy dist files to gh-pages/dist
Browse files Browse the repository at this point in the history
  • Loading branch information
adon committed Jul 16, 2015
1 parent a76c52b commit 9b99f21
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ artifacts
coverage

# build
docs
docs
26 changes: 18 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,24 @@ notifications:
- [email protected]
on_success: change
on_failure: always
env:
global:
- GH_REF: github.com/yahoo/secure-handlebars.git
- secure: IMKSQkQZnZVVtPKwzwt3n5RE4JUcHcY/ySKrQXCDA+Drzll6q31fJns+lN9xGfWMwWfv12+PXPvM+WU1o5IjuvfKOSxfLqy8xl1XxH3sJZuK4R1CI9SHToydJJu5V9zZeO40AvD+5G3Z5u6hOqrf2lbiaqq3zVz8DtEKxSg3OcE=
after_success:
- test $(cat $TRAVIS_BUILD_DIR/package.json | grep version | awk '{print $2}' | sed 's/"//g' | sed 's/,//g' | awk '{print "v"$1}' ) = $TRAVIS_TAG && test $(echo $TRAVIS_NODE_VERSION | awk '{print $1}' ) = '0.12' && export VALID_VERSION=true
deploy:
provider: npm
email: [email protected]
api_key:
secure: TNDHDZslbeI3CKi50Pe6wR6ZN+iAGsfaZ3+mFP/2w761bQV0Yc2Dbt2mP57sV8OHhP3XeKG7F3WXVLks9gu/pre6QObBQQEZlv7ojJKbvU+MYgedMw5VuehPT5Q8bz8mngkYvckL7uLegXiqTbPhsohfK00/xGzla0/RePeklpM=
on:
condition: $VALID_VERSION = true
tags: true
branch: master
- provider: npm
email: [email protected]
api_key:
secure: TNDHDZslbeI3CKi50Pe6wR6ZN+iAGsfaZ3+mFP/2w761bQV0Yc2Dbt2mP57sV8OHhP3XeKG7F3WXVLks9gu/pre6QObBQQEZlv7ojJKbvU+MYgedMw5VuehPT5Q8bz8mngkYvckL7uLegXiqTbPhsohfK00/xGzla0/RePeklpM=
on:
condition: $VALID_VERSION = true
tags: true
branch: master
- provider: script
script: ./bin/auto-push-gh-pages.sh
on:
condition: $VALID_VERSION = true
tags: true
branch: master
18 changes: 18 additions & 0 deletions bin/auto-push-gh-pages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
# Assumption: all files are readily built and located at dist/

git clone "https://${GH_REF}" -b gh-pages gh-pages

# copy all files from dist to gh-pages/dist
mkdir gh-pages/dist
cp dist/* gh-pages/dist/

# set username as gh-pages-robot
cd gh-pages
git config --local user.name "gh-pages-robot"
git config --local user.email "[email protected]"

git add dist/.
git commit -m "Deploy latest dist files to gh-pages"

git push --quiet "https://${GH_TOKEN}@${GH_REF}" > /dev/null 2>&1

0 comments on commit 9b99f21

Please sign in to comment.