Skip to content

Commit

Permalink
first attempt at automated docs build.
Browse files Browse the repository at this point in the history
  • Loading branch information
ctalkington committed Dec 22, 2015
1 parent 1fcc8c3 commit 201ba0d
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 6 deletions.
16 changes: 12 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
sudo: false
language: node_js
node_js:
- "4.0"
- "0.12"
- "0.10"
- '4.0'
- '0.12'
- '0.10'
matrix:
fast_finish: true
fast_finish: true
env:
global:
GH_REPO: github.com/archiverjs/website.git
GH_REPO_BRANCH: master
GH_REPO_DOCSDIR: docs
secure: EKToLBZ66qitO7xrRmytgO0Rm53AVw3IevMtmRVvZ+8tCrwXUmkmGgY5E1aPa3fvtaZPZjtSQGOzSuJ0CR01Ktr70UzkC6YLhbw6IAEwU/AaHmQiHVBoJQTTxgZEk1Mku94M3m8IoZSVky98ShzfLU/cBJfmb3Lb7v4RgJGvTB0=
after_success:
- bash ./deploy.sh
63 changes: 63 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
set -e

echo -n $TRAVIS_REPO_SLUG
echo -n $TRAVIS_NODE_VERSION

if [ "$TRAVIS_REPO_SLUG" != "archiverjs/node-archiver" ] || [ "$TRAVIS_PULL_REQUEST" == "true" ]; then
exit 0
fi

if [ "$TRAVIS_BRANCH" != "master" ] || [ "$TRAVIS_NODE_VERSION" != "4.0" ]; then
exit 0
fi

if [ -z "$GH_REPO" ] || [ -z "$GH_SECRET_TOKEN" ]; then
echo "Missing required environment variables to run deploy."
exit 1
fi

if [ -z "$GH_USER_EMAIL" ]; then
GH_USER_EMAIL = "[email protected]"
fi

if [ -z "$GH_USER_NAME" ]; then
GH_USER_NAME = "travis-ci"
fi

if [ -z "$GH_REPO_BRANCH" ]; then
GH_REPO_BRANCH = "master"
fi

if [ -z "$GH_REPO_DOCSDIR" ]; then
GH_REPO_BRANCH = "docs"
fi

if [ -z "$GH_REPO_TMPNAME" ]; then
GH_REPO_TMPNAME = "jsdoc-deploy"
fi

GH_REPO_TMPNAME_STAGED = "${GH_REPO_TMPNAME}-staging"

echo -e "Running jsdoc...\n"
npm run-script jsdoc
cp -R tmp/jsdoc $HOME/${GH_REPO_TMPNAME_STAGED}

echo -e "Publishing jsdoc...\n"

cd $HOME

git config --global user.email $GH_USER_EMAIL
git config --global user.name $GH_USER_NAME
git clone --quiet --branch=${GH_REPO_BRANCH} https://${GH_SECRET_TOKEN}@${GH_REPO} ${GH_REPO_TMPNAME} > /dev/null

cd $GH_REPO_TMPNAME
git rm -rf ./$GH_REPO_DOCSDIR
cp -Rf $HOME/$GH_REPO_TMPNAME_STAGED ./$GH_REPO_DOCSDIR
git status
#git add -f .
#git commit -m "deploy: latest jsdoc on successful travis build $TRAVIS_BUILD_NUMBER."
#git push -fq origin $GH_REPO_BRANCH > /dev/null

#echo -e "Published jsdoc.\n"

2 changes: 1 addition & 1 deletion jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"opts": {
"recurse": true,
"destination": "../archiver-website/docs/",
"destination": "tmp/jsdoc/",
"template": "node_modules/minami"
},
"plugins": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
},
"scripts": {
"test": "mocha --reporter dot",
"gendocs": "jsdoc -c jsdoc.json readme.md",
"jsdoc": "jsdoc -c jsdoc.json readme.md",
"bench": "node benchmark/simple/pack-zip.js"
},
"dependencies": {
Expand Down

0 comments on commit 201ba0d

Please sign in to comment.