Skip to content

Commit

Permalink
Supporting automatic documentation deployment.
Browse files Browse the repository at this point in the history
  • Loading branch information
wbyoung committed Jan 2, 2015
1 parent 038c0dd commit 954fb35
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 7 deletions.
28 changes: 22 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,28 @@
language: node_js

node_js:
- '0.10'
- '0.11'
- '0.10'
- '0.11'

script: npm run $ACTION

before_script:
- psql -c 'create database "azul_test";' -U postgres
- mysql -e 'create database `azul_test`;'
env: PG_USER=postgres MYSQL_USER=travis
- psql -c 'create database "azul_test";' -U postgres
- mysql -e 'create database `azul_test`;'

env:
- ACTION=test PG_USER=postgres MYSQL_USER=travis
- ACTION=docs

matrix:
exclude:
- env: ACTION=docs
include:
- env: ACTION=docs
node_js: '0.10'
allow_failures:
- node_js: '0.11'
- node_js: '0.11'

fast_finish: true

sudo: false
24 changes: 24 additions & 0 deletions docs/deploy
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

# note that $GITHUB_REPO contains an API key in it, so be careful to not allow
# that to end up as part of the output ever.

set -e

if [ "`git rev-parse HEAD`" != "`git rev-parse origin/master --`" ]; then
echo "Not deploying docs for non-master commit `git rev-parse --short HEAD`"
exit 0
fi

mkdir -p .deploy
cd .deploy
git clone -q --depth 1 --branch gh-pages --single-branch $GITHUB_REPO .
git config user.name $GITHUB_NAME
git config user.email $GITHUB_EMAIL

rm -rf ./*
cp -r ../public/* .

git add -A .
git commit -m 'Site updated' || echo 'No update required.'
git push -q origin gh-pages
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
},
"main": "index.js",
"scripts": {
"test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report $(if [ \"$TRAVIS\" ]; then echo lcovonly; else echo html; fi) -- --recursive && if [ \"$TRAVIS\" ]; then cat ./coverage/lcov.info | ./node_modules/.bin/coveralls; fi"
"test": "./node_modules/.bin/istanbul cover ./node_modules/.bin/_mocha --report $(if [ \"$TRAVIS\" ]; then echo lcovonly; else echo html; fi) -- --recursive && if [ \"$TRAVIS\" ]; then cat ./coverage/lcov.info | ./node_modules/.bin/coveralls; fi",
"docs": "mkdir -p public; echo \"# Azul.js Website\" > public/README.md; ./docs/deploy"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 954fb35

Please sign in to comment.