From 954fb35c07eb5c04abe7c6d6f970b8f2d0207148 Mon Sep 17 00:00:00 2001 From: Whitney Young Date: Wed, 31 Dec 2014 17:01:03 -0800 Subject: [PATCH] Supporting automatic documentation deployment. --- .travis.yml | 28 ++++++++++++++++++++++------ docs/deploy | 24 ++++++++++++++++++++++++ package.json | 3 ++- 3 files changed, 48 insertions(+), 7 deletions(-) create mode 100755 docs/deploy diff --git a/.travis.yml b/.travis.yml index b411eb2..cbd8dab 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/docs/deploy b/docs/deploy new file mode 100755 index 0000000..0908bde --- /dev/null +++ b/docs/deploy @@ -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 diff --git a/package.json b/package.json index b91fc0e..996ec8e 100644 --- a/package.json +++ b/package.json @@ -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",