Skip to content

Commit 0341f41

Browse files
committed
generate site with gh-pages-generator
1 parent 0775e3c commit 0341f41

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
language: node_js
22
node_js:
33
- "4"
4+
after_script:
5+
- scripts/travis-gh-pages

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"devDependencies": {
2626
"ajv": "^3.6.2",
2727
"dot": "^1.0.3",
28+
"gh-pages-generator": "^0.2.2",
2829
"json-schema-test": "^1.2.1",
2930
"mocha": "^2.2.5",
3031
"pre-commit": "^1.1.2"

scripts/travis-gh-pages

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then
6+
git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qE '\.md$|\.json$|^LICENSE$' && {
7+
rm -rf ../gh-pages
8+
git clone -b gh-pages --single-branch https://${GITHUB_TOKEN}@github.com/epoberezkin/ajv.git ../gh-pages
9+
mkdir -p ../gh-pages/_source
10+
cp *.md ../gh-pages/_source
11+
cp LICENSE ../gh-pages/_source
12+
currentDir=$(pwd)
13+
cd ../gh-pages
14+
$currentDir/node_modules/.bin/gh-pages-generator
15+
git config user.email "$GIT_USER_EMAIL"
16+
git config user.name "$GIT_USER_NAME"
17+
git add .
18+
git commit -am "updated by travis build #$TRAVIS_BUILD_NUMBER"
19+
git push --quiet origin gh-pages > /dev/null 2>&1
20+
}
21+
fi

0 commit comments

Comments
 (0)